forked from aiidateam/aiida-core
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added missing pyzmq requirement #5
Open
muhrin
wants to merge
10
commits into
unkcpz:asyncio-rebase
Choose a base branch
from
muhrin:fix-missing-pyzmq
base: asyncio-rebase
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The `plumpy` and `kiwipy` dependencies have already been migrated from using `tornado` to the Python built-in module `asyncio` in the versions `0.16.0` and `0.6.0`, respectively. This allows us to also rid AiiDA of the `tornado` dependency, which has been giving requirement clashes with other tools, specifically from the Jupyter and iPython world. A summary of the changes: * Replace `tornado.ioloop` with `asyncio` event loop. * Coroutines are marked with `async` instead of decorated with the `tornado.gen.coroutine` decorator. * Replace `yield` with `await` when calling a coroutine. * Replace `raise tornado.gen.Return` with `return` when returning from a coroutine. * Replace `add_callback` call on event loop with `call_soon` when scheduling a callback. * Replace `add_callback` call on event loop with `create_task` when scheduling `process.step_until_terminated()`. * Replace `run_sync` call on event loop with `run_until_complete`. * Replace `pika` uses with `aio-pika` which is now used by the `plumpy` and `kiwipy` libraries. * Replace `concurrent.Future` with `asyncio.Future`. * Replace `yield tornado.gen.sleep` with `await asyncio.sleep`. Additional changes: * Remove the `tornado` logger from the logging configuration. * Remove the `logging.tornado_loglevel` configuration option. * Turn the `TransportQueue.loop` attribute from method into property. * Call `Communicator.close()` instead of `Communicator.stop()` in the `Manager.close()` method. The `stop` method has been deprecated in `kiwipy==0.6.0`.
The result returned by `ProcessController.kill_process` that is called in `Process.kill` for each of its children, if it has any, can itself be a future, since the killing cannot always be performed directly, but instead will be scheduled in the event loop. To resolve the future of the main process, it will have to wait for the futures of all its children to be resolved as well. Therefore an intermediate future needs to be added that will be done once all child futures are resolved.
The commands of `verdi process` that perform an RPC on a live process will do so through the `ProcessController`, which returns a future. Currently, the process controller uses the `LoopCommunicator` as its communicator which adds an additional layer of wrapping. Ideally, the return type of the communicator should not change depending on the specific implementation that is used, however, for now that is the case and so the future needs to be unwrapped explicitly one additional time. Once the `LoopCommunicator` is fixed to return the same future type as the base `Communicator` class, this workaround can and should be removed.
With the migration to `asyncio`, there is now only a single event loop that is made reentrant through the `nest-asyncio` library, that monkey patches `asyncio`'s built-in mechanism to prevent this. This means that in the `Runner` constructor, we should simply get the global event loop instead of creating a new one, if no explicit loop is passed into the constructor. This also implies that the runner should never take charge in closing the loop, because it no longer owns the global loop. In addition, process functions now simply use the global runner instead of creating a new runner. This used to be necessary because running in the same runner, would mean running in the same loop and so the child process would block the parent. However, with the new design on `asyncio`, everything runs in a single reentrant loop and so child processes no longer need to spawn their own independent nested runner.
When a daemon runner is started, the `SIGINT` and `SIGTERM` signals are captured to shutdown the runner before exiting the interpreter. However, the async tasks associated with the interpreter should be properly canceled first.
This version still requires `tornado<5` and this clashes with a whole host of other (indirect) dependencies. Note that develop branch of `circus` is compatible with `tornado>=5` but it hasn't been released as of yet.
This was missing from the list of requirements, probably because it used to be installed by other downstream packages. I found it by just installing '.[tests]' which didn't include it even though AiiDA uses it in a few places like tests and the daemon start/stop.
muhrin
force-pushed
the
fix-missing-pyzmq
branch
from
September 9, 2020 15:56
59e7887
to
d56a953
Compare
unkcpz
force-pushed
the
asyncio-rebase
branch
2 times, most recently
from
September 19, 2020 04:07
2ef0ecd
to
4ed9ffe
Compare
sphuber
force-pushed
the
asyncio-rebase
branch
from
September 19, 2020 09:37
4ed9ffe
to
ebc035c
Compare
sphuber
force-pushed
the
asyncio-rebase
branch
from
October 15, 2020 13:30
ebc035c
to
c6bd582
Compare
unkcpz
force-pushed
the
asyncio-rebase
branch
2 times, most recently
from
October 20, 2020 09:25
fa5344c
to
7e2ba0e
Compare
unkcpz
force-pushed
the
asyncio-rebase
branch
from
November 3, 2020 03:24
7e2ba0e
to
b7eace2
Compare
sphuber
force-pushed
the
asyncio-rebase
branch
7 times, most recently
from
November 18, 2020 16:59
21edfef
to
8cfadb0
Compare
sphuber
force-pushed
the
asyncio-rebase
branch
3 times, most recently
from
November 27, 2020 12:42
ee92f59
to
80af135
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi Jason. Just a small missing dependency to add.
This was missing from the list of requirements, probably because it used
to be installed by other downstream packages. I found it by just
installing '.[tests]' which didn't include it even though AiiDA uses it
in a few places like tests and the daemon start/stop.