🔀 REFACTOR: workchain subprocess queing #5838
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A proposal to change how to add a subprocess in a workchain step
(sidenote: this PR is fully back-compatible)
On the user side, basically I think we should replace the use of
self.submit
/self.to_context
/ToContext
, with simplyself.queue_subprocess
.This better describes what we are actually intending the user to do:
e.g. change this:
to this:
On the internal code side:
renamed some things to not use the term
awaitable
, which has a very definite meaning in python/plumpy (https://docs.python.org/3/library/collections.abc.html#collections.abc.Awaitable, https://docs.python.org/3/library/typing.html#typing.Awaitable) and instead refer to "process references"Use a
dataclass
instead of anAttributeDict
, since this has various issues for type safetyNotes:
This currently is fully backward-compatible; it doesn't actually remove any of
self.submit
/self.to_context
/ToContext
.deprecation warnings could be added though.
Currently
self.queue_subprocess
works exactly the same as if you didself.submit
thenself.to_context
.I don't think this technically correct, though, since I think subprocess submission should only really happen after all the code in the step has been run. Otherwise, you can submit a process, then except the step, and now you have a subprocess running that you don't actually want.