-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔃 REFACTOR: Move Scheduler/Transport behind Client API #5901
Conversation
Move API behind `ClientProtocol` interface, which "holds" both the Transport and Scheduler. This means that the Scheduler/Transport APIs remain completely unchanged, but it allows for other plugins (such as FireCrest) to to implement the single client API, to do both jobs
for more information, see https://pre-commit.ci
Ok it's rough around the edges (see e.g. the TODO comments that are the only thing failing the pre-commit: https://github.com/aiidateam/aiida-core/actions/runs/4338703386/jobs/7575599288), What does it do:
Some things that could potentially be extracted to separate PRs:
So yes cc @giovannipizzi @sphuber @ltalirz etc, if you wanna have a look and initial comments (just don't get too hung up on module/class names 😅 ) |
This commit firstly reworks the protocol, to split off methods that require a connected client into `ComputeClientOpenProtocol`, this does not change the concrete implementation, but it improves type checking and makes it clearer in the code base where open clients are expected. Some pointers were taking from https://mypy.readthedocs.io/en/latest/protocols.html#defining-subprotocols-and-subclassing-protocols Once this was done, then all classmethods were changed to standard (instance) method. The class methods were unnecessary, given that instantiation of an instance has no side-effects, and presented issues for ComputeClientXY (the transport/scheduler combined class)
Some changes, as per the commit message in bcfdf4b: This commit firstly reworks the protocol interface a bit, to split off methods that require a connected client into Then also all classmethods were changed to standard (instance) method. |
(p.s. stirred a big conversation about protocols during this 😅 python/cpython#102433, python/typing#1363) |
Closing this as it is superseded by #6043 |
Move API behind
ClientProtocol
interface, which "holds" both the Transport and Scheduler.This means that the Scheduler/Transport APIs remain completely unchanged, but it allows for other plugins (such as FireCrest) to to implement the single client API, to do both jobs