Skip to content

Make the scheduler interface asynchronous - #7462

Open
khsrali wants to merge 1 commit into
aiidateam:v3from
khsrali:async-scheduler
Open

Make the scheduler interface asynchronous#7462
khsrali wants to merge 1 commit into
aiidateam:v3from
khsrali:async-scheduler

Conversation

@khsrali

@khsrali khsrali commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Once v3 releases and if this merges, we should spawn agents to open PRs/issues on all external scheduler plugins giving them upgrade instructions.

These changes are backward incompatible.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a31fa836-bd33-4e68-af4c-9c952523c52a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@khsrali
khsrali requested a review from agoscinski July 17, 2026 16:38
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 34.48276% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.99%. Comparing base (cd9024c) to head (089d7e1).

Files with missing lines Patch % Lines
src/aiida/cmdline/commands/cmd_computer.py 0.00% 4 Missing ⚠️
src/aiida/engine/daemon/execmanager.py 33.34% 4 Missing ⚠️
src/aiida/schedulers/plugins/bash.py 42.86% 4 Missing ⚠️
src/aiida/engine/processes/calcjobs/tasks.py 0.00% 3 Missing ⚠️
src/aiida/engine/processes/calcjobs/manager.py 0.00% 2 Missing ⚠️
src/aiida/schedulers/plugins/direct.py 50.00% 1 Missing ⚠️
src/aiida/schedulers/scheduler.py 80.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (cd9024c) and HEAD (089d7e1). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (cd9024c) HEAD (089d7e1)
6 1
Additional details and impacted files
@@             Coverage Diff             @@
##               v3    #7462       +/-   ##
===========================================
- Coverage   80.39%   29.99%   -50.39%     
===========================================
  Files         578      578               
  Lines       46128    46129        +1     
===========================================
- Hits        37081    13833    -23248     
- Misses       9047    32296    +23249     

☔ 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.

@agoscinski agoscinski linked an issue Aug 13, 2026 that may be closed by this pull request

@agoscinski agoscinski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Can you update the Changelog with a section Breaking, and note there all the public API changes you do in this PR? Does not need to be anything complicated. A list like this def kill_job -> async def kill_job_async would be enough for now. Later we can put this properly in a json and use this to upgrade automatically plugins, and error out in case people use these functions. For the Scheduler its properly less useful, but lets stay consistent with all PRs.



Checking the queued jobs on a scheduler
=======================================

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, if we need to still offer some utility for users to use this function. Can you check with @t-reents @mikeatm if people have actually a need for this functionality?


from aiida.manage import get_manager

loop = get_manager().get_runner().loop

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm.. runner spins up a lot of things we do not need for just accessing the scheduler information. I would try to use only the runner if we want to run aiida processes. I am tending to just use get_event_loop so this private function does not spin up an event loop, in python 3.14 we get here then a RuntimeError if misused. The responsibility of starting the event loop lies in the command. For that we create a @with_event_loop decorator like @with_dbenv. I think this way we can also properly close the event loop.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Make scheduler async

2 participants