-
Notifications
You must be signed in to change notification settings - Fork 17
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
kiwipy/rmq related modules into independent module #297
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #297 +/- ##
======================================
Coverage ? 89.80%
======================================
Files ? 28
Lines ? 3176
Branches ? 0
======================================
Hits ? 2852
Misses ? 324
Partials ? 0 ☔ View full report in Codecov by Sentry. |
156d81a
to
fc52fcd
Compare
3b8104b
to
5af4710
Compare
947fa3b
to
aebec4f
Compare
85fc72a
to
da644ac
Compare
class MockCoordinator: | ||
def __init__(self): | ||
self._task_subscribers = {} | ||
self._broadcast_subscribers = {} | ||
self._rpc_subscribers = {} | ||
self._closed = False | ||
|
||
def is_closed(self) -> bool: | ||
return self._closed | ||
|
||
def close(self): | ||
if self._closed: | ||
return | ||
self._closed = True | ||
del self._task_subscribers | ||
del self._broadcast_subscribers | ||
del self._rpc_subscribers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the Mocked in memory coordinator that in principle can work with sqlite in presto and make it able to submit the calculations.
The refactoring is targeting to decouple the dependencies of using kiwipy+rmq as the communicator for the process control.
By forming a
Coordinator
protocol contract, the different type of rmq/kiwipy related codes are removed out from plumpy logic. The new contract also pave the way to make it clearly show how a new type coordinator can be implemented (future examples will be thetatzelwurm
a task broker that has scheduler support and file based task broker require no background service).For the prototype of how a coordinator should look like, the
MockCoordinator
intests/utils
is the coordinator that store things in memory, and can serve as the lightweight ephemeral daemon without persistent functionality.Another major change here is hand write the resolver of future by mimic how tho asyncio does for wrapping
concurrent.futures.Future
intoasyncio.Future
. I use the same way to convertasyncio.Future
intoconcurent.futures.Future
(which is thekiwipy.Future
as alias).aio_pika
import lazily by moving the rmq exceptions tormq
module, this can increase the performance ofimport aiida; aiida.orm
.CancellableAction
using composite to behave as a Future like object.asyncio.Future
in favor of aliasplumpy.Future
andconcurrent.futures.Future
instead of aliaskiwipy.Future
._chain
and_copy_future
since we can not just rely on the API of asyncio that is not exposed.coordinator/Communicator
protocol.coordinator/Coordinator
protocol and wrap rmq/communicator as a coordinator that not require changs in kiwipy.