Skip to content

Scheduler with WorkGraph slice - #7625

Draft
agoscinski wants to merge 5 commits into
mainfrom
workgraph-scheduler
Draft

agoscinski wants to merge 5 commits into
mainfrom
workgraph-scheduler

Conversation

@agoscinski

Copy link
Copy Markdown
Collaborator

No description provided.

Route broker tasks through named persistent queues so submission can be
separated from execution. The default queue keeps the legacy 'tasks'
storage directory and behaviour; additional queues get 'tasks-<name>'
directories with validated names. Queue membership is tracked per
subscription, dispatch only serves subscribed workers, and ACKs route to
the owning queue with a fallback scan that also covers post-restart
recovery. 'queue' threads from task messages and subscriptions through
the communicator, 'LoopCommunicator', 'RemoteProcessThreadController'
and 'Runner', defaulting to current behaviour everywhere. Covered by
queue-routing unit tests; existing broker suites stay green.

✨ Add scheduler service gating submissions

Provide the 'aiida.scheduler' package with a 'Scheduler' service that
subscribes to the scheduler queue and forwards admitted tasks to the
worker queue. It reuses the controller submission vocabulary and creates
its communicator behind 'create_communicator' for later transports.
Covered by unit tests, live forwarding tests, and a real process
submitted through the scheduler queue to a daemon worker.

♻️ Compose controller in scheduler service

Give the scheduler an owned 'RemoteProcessThreadController' for the
forwarding path instead of inheriting it. A scheduler uses submission
vocabulary, it is not a controller: composition keeps the public surface
narrow and controller evolution from leaking into the scheduler as
orchestration grows. No behaviour change.

✨ Track task lifecycle from completion broadcasts

Teach the scheduler the return leg of the loop: it subscribes to worker
completion broadcasts ('scheduler.task.completed/failed') and records
them in a lifecycle registry with in-flight counts. Unknown subjects are
ignored; completions for unknown or terminal tasks count as duplicates,
never as state changes. Worker-side announcements are the follow-up; the
receiving half and its subjects are settled here.
rm linbreak

✨ Detect process kinds for scheduler throttling

Classify submissions without touching the message protocol or engine submission path: launch bodies resolve their process-class identifier through an explicit registry with loader fallback, continue bodies load the checkpoint node by pid and read node_type. Kinds drive the per-kind concurrency caps. Document the message-handling logic as pseudocode in the module docstring.

🔧 Drop legacy task-id aliases from scheduler

Completions resolve by stamped scheduler id only. The alias map translating submitter-provided task ids was backward-compat glue for a protocol nobody speaks; the duplicate counter already signals genuinely unknown completions.

✨ Add WorkGraphScheduler orchestration interface

Provide an abstract workgraph policy owned as a scheduler member: workgraph-kind records delegate initial and follow-up dispatches to it while containers themselves are never forwarded. The 'workgraph' kind is reserved and mapped ahead of the future node type; without an installed member such tasks take the normal path. Returned bodies re-enter core admission.

✨ Announce worker completions via ProcessListener

Add a plumpy ProcessListener bound per launched task that publishes terminal receipts to the durable completions queue. No Process subclass changes: listeners are additive. Wiring into launchers is documented but left unwired.

Rename scheduler event listener

♻️ Remove scheduler workgraph orchestration
scheduler + workgraph

This reverts commit 4c5e8e0038100b3e1ff03435bf2df93647c14173.

✨ Classify scheduler workgraph tasks
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.93642% with 322 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.16%. Comparing base (a4f200d) to head (bbf46e5).

Files with missing lines Patch % Lines
src/aiida/scheduler/scheduler.py 0.00% 180 Missing ⚠️
src/aiida/brokers/zeromq/server.py 5.50% 86 Missing ⚠️
src/aiida/scheduler/event_listener.py 0.00% 24 Missing ⚠️
src/aiida/engine/processes/communications.py 23.53% 13 Missing ⚠️
src/aiida/brokers/zeromq/communicator.py 27.28% 8 Missing ⚠️
src/aiida/brokers/zeromq/broker.py 0.00% 7 Missing ⚠️
src/aiida/scheduler/__init__.py 0.00% 3 Missing ⚠️
src/aiida/engine/runners.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7625       +/-   ##
===========================================
- Coverage   83.34%   33.16%   -50.17%     
===========================================
  Files         614      617        +3     
  Lines       50774    51064      +290     
===========================================
- Hits        42312    16932    -25380     
- Misses       8462    34132    +25670     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant