feat(tasks): dispatch_task/get_task_status generic caller/args dispatch #73

Closed
pyr0ball wants to merge 0 commits from feat/67-dispatch-task into main
Owner

Summary

  • New circuitforge_core.tasks.dispatch module: register_task_runner(caller, fn), dispatch_task(caller, args) -> task_id, get_task_status(task_id) -> dict. Closes the gap where pagepiper's app/api/library.py imported these expecting a caller/args interface that existed nowhere in cf-core, silently hitting an except-Exception fallback.
  • Distinct from the existing VRAM-budgeted TaskScheduler (task_id/job_id/params against a specific SQLite table) - a new module, not a wrapper, since the shapes don't match.
  • Free-tier, in-process, single-node implementation on a background ThreadPoolExecutor. dispatch_task() raises LookupError for an unregistered caller so existing except-Exception fallbacks (pagepiper's _dispatch_ingest) keep working unchanged. get_task_status() raises KeyError for an unknown task_id.
  • Scope note: cross-node routing through circuitforge-orch's coordinator would need a new generic task-dispatch endpoint on that separate BSL package (CFOrchClient only exposes model/service allocation today) - tracked as follow-up, not attempted in this cf-core-only PR. Pagepiper itself still needs to call register_task_runner() at startup to actually benefit - that's separate-repo follow-up work, not done here.

Closes #67

Test plan

  • pytest tests/test_tasks -v - 18/18 passed (10 new for dispatch, 8 existing scheduler tests untouched)
## Summary - New circuitforge_core.tasks.dispatch module: register_task_runner(caller, fn), dispatch_task(caller, args) -> task_id, get_task_status(task_id) -> dict. Closes the gap where pagepiper's app/api/library.py imported these expecting a caller/args interface that existed nowhere in cf-core, silently hitting an except-Exception fallback. - Distinct from the existing VRAM-budgeted TaskScheduler (task_id/job_id/params against a specific SQLite table) - a new module, not a wrapper, since the shapes don't match. - Free-tier, in-process, single-node implementation on a background ThreadPoolExecutor. dispatch_task() raises LookupError for an unregistered caller so existing except-Exception fallbacks (pagepiper's _dispatch_ingest) keep working unchanged. get_task_status() raises KeyError for an unknown task_id. - Scope note: cross-node routing through circuitforge-orch's coordinator would need a new generic task-dispatch endpoint on that separate BSL package (CFOrchClient only exposes model/service allocation today) - tracked as follow-up, not attempted in this cf-core-only PR. Pagepiper itself still needs to call register_task_runner() at startup to actually benefit - that's separate-repo follow-up work, not done here. Closes #67 ## Test plan - [x] pytest tests/test_tasks -v - 18/18 passed (10 new for dispatch, 8 existing scheduler tests untouched)
pyr0ball added 1 commit 2026-07-10 18:09:04 -07:00
feat(tasks): implement dispatch_task/get_task_status generic caller/args dispatch
Some checks failed
CI / test (pull_request) Has been cancelled
43f9e9a54c
Pagepiper (and possibly other products copying its pattern) imported
dispatch_task(caller, args) -> task_id / get_task_status(task_id) -> dict
from circuitforge_core.tasks, expecting a "product/task_name" + kwargs-dict
interface. Neither function existed, so every call silently hit an
except-Exception fallback with no visible error.

This is a new module, not a TaskScheduler wrapper — TaskScheduler is keyed
by task_id/job_id/params against a specific SQLite background_tasks table
(VRAM-budgeted LLM queue), a different shape from the generic named-runnable
dispatch pagepiper actually needed.

Scope: free-tier, in-process, single-node only. Routing through the
circuitforge-orch coordinator would need a new generic task-dispatch
endpoint on that separate BSL package (CFOrchClient only exposes model/
service allocation today) — tracked as follow-up, not attempted here.
Consuming products additionally need to call register_task_runner() at
startup to benefit; that's product-side work in a separate repo.

Bump to 0.22.0.

Closes: #67
Author
Owner

Merged into main via the freeze/0.22.0 integration branch (fast-forward) and released as v0.22.0: https://git.opensourcesolarpunk.com/Circuit-Forge/circuitforge-core/releases/tag/v0.22.0. Closing since the commits are already on main.

Merged into main via the freeze/0.22.0 integration branch (fast-forward) and released as v0.22.0: https://git.opensourcesolarpunk.com/Circuit-Forge/circuitforge-core/releases/tag/v0.22.0. Closing since the commits are already on main.
pyr0ball closed this pull request 2026-07-10 19:21:10 -07:00
Some checks failed
CI / test (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/circuitforge-core#73
No description provided.