Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
bfbe78d
Use uv.lock
unkcpz Jan 17, 2025
bf15eee
Defer import of aio_pika
unkcpz Dec 11, 2024
7c1afd3
Explicit future implementation: distinguish concurrent.future.Future …
unkcpz Dec 11, 2024
981fa91
Move communication into rmq module
unkcpz Dec 11, 2024
ffbe298
Move TaskRejectError as the common exception for task launch
unkcpz Dec 14, 2024
7e67037
Remove useless communicator param passed to ProcessLaunch __call__
unkcpz Dec 14, 2024
1a18f9e
Forming Communicator protocol
unkcpz Dec 14, 2024
b96d52d
Remove kiwipy/rmq dependencies of process module
unkcpz Dec 14, 2024
c02bba4
Interface change from communicator -> coordinator
unkcpz Dec 17, 2024
3fddff0
Remove unnecessary task_send ab from RemoteProcessControl interface
unkcpz Dec 17, 2024
6aecacc
Interface for ProcessController
unkcpz Dec 17, 2024
071938d
RmqCoordinator example to show how using interface can avoid making c…
unkcpz Dec 17, 2024
bf1275b
broadcast subscriber has versatile filters
unkcpz Dec 18, 2024
2cfcb1c
Generic typing for Coordinator
unkcpz Dec 19, 2024
d83db64
changes required for aiida-core support
unkcpz Dec 19, 2024
d84ad62
Adopt new message protocol
unkcpz Dec 20, 2024
9065d9a
Simpler create_task_threadsafe implementation
unkcpz Dec 30, 2024
39d363f
Remove RmqCoordinator to tests/util only
unkcpz Jan 10, 2025
6d3101d
Export plumpy.futures.Future
unkcpz Jan 11, 2025
5399404
Merge pull request #6 from unkcpz/rmq-out
unkcpz Jan 17, 2025
19ef505
Explict module import list in __init__.py (#8)
unkcpz Jan 18, 2025
c19a7d5
Remove the middle layer of statemachine.State + Savable abstraction
unkcpz Dec 2, 2024
a88d76d
Move is_terminal as class attribute required
unkcpz Dec 2, 2024
95a945b
forming the enter/exit for State protocol
unkcpz Dec 2, 2024
7000b5b
Forming Interruptable and Proceedable protocol
unkcpz Dec 2, 2024
7ed200d
Refactoring create_state as static function initialize state from label
unkcpz Dec 2, 2024
4bd4377
Merge pull request #10 from unkcpz/notjustrmq-rebase
unkcpz Jan 18, 2025
98f46bb
To lenthy for rethinking
unkcpz Dec 4, 2024
a6705bd
Move static method load outside
unkcpz Dec 4, 2024
eefd7b7
save_instance_state simplify to only has save interface
unkcpz Dec 9, 2024
4c4044c
load_instance_state deabstract simplify
unkcpz Dec 9, 2024
4e95fc3
ProcessListener recreate_from
unkcpz Dec 9, 2024
7557a3f
Absorb all load_instance_state into recreate_from
unkcpz Dec 9, 2024
11dfacb
Remove useless persist method of Savable class
unkcpz Dec 9, 2024
558e2a1
Explicity recreate_from implementation
unkcpz Dec 9, 2024
23abe62
forming Savable protocol
unkcpz Dec 9, 2024
629832c
Make auto_load symmetry with auto_save and state/state_label distinguish
unkcpz Dec 10, 2024
d524e63
misc rebase
unkcpz Jan 18, 2025
c3f0995
debug logger when state change
unkcpz Jan 18, 2025
75ff4a3
logger for load process from context
unkcpz Jan 18, 2025
a90dcff
Using typing-extensions for 3.9 support of @override
unkcpz Jan 22, 2025
4ff17e0
Merge pull request #5 from unkcpz/deab-savable-inh
unkcpz Jan 23, 2025
83080ac
test and typing generic for the state savable types
unkcpz Jan 22, 2025
1769cee
test for command is savable
unkcpz Jan 22, 2025
7a1430e
absorb _get_value into load_auto_persist_params
unkcpz Jan 22, 2025
51f621c
runtime check state command is loaded as command
unkcpz Jan 22, 2025
34ea796
Remove load_context use if not needed
unkcpz Jan 22, 2025
51e1245
save(self, loader)
unkcpz Jan 22, 2025
99d00ee
Update persistence test using custom object loader
unkcpz Jan 22, 2025
e1b68d7
Test to show the default loader can only load obj in python path
unkcpz Jan 22, 2025
31d9d2a
Process is savable
unkcpz Jan 22, 2025
f428eec
ProcessListener is savable
unkcpz Jan 22, 2025
8f85ea6
test workchain is savable
unkcpz Jan 22, 2025
64929b7
support save/load collection data in auto_persist
unkcpz Jan 22, 2025
9846280
test_event_helper_savable
unkcpz Jan 22, 2025
24d73a0
Move test_workchain and test func_stepper savable
unkcpz Jan 23, 2025
06476a6
Merge pull request #11 from unkcpz/savable-protocol-test
unkcpz Jan 23, 2025
718e2b2
Drop support for python 3.8/3.9
unkcpz Jan 23, 2025
185f0c2
>3.9 typing
unkcpz Jan 23, 2025
493e017
remove all __future__ annotations
unkcpz Jan 23, 2025
c8df99f
Merge pull request #15 from unkcpz/drop-py3.9
unkcpz Jan 23, 2025
eca3ae3
Drop unittest entirely (#24)
unkcpz Jan 28, 2025
4edd4df
Use msgpack for control message passing (#27)
unkcpz Jan 30, 2025
0730394
Create/Launch/Continue body into builder (#26)
unkcpz Jan 31, 2025
c6d5b8f
Correct typing in workchain.py (#21)
unkcpz Jan 31, 2025
49ea4e1
Bump to use pytest-asyncio ~=0.25 which deprecate get_event_loop (#29)
unkcpz Jan 31, 2025
2dc2a31
Using customized get_event_loop from PlumpyEventLoopPolicy (#30)
unkcpz Jan 31, 2025
b914781
Using custom event loop for nested process tests (#31)
unkcpz Jan 31, 2025
0901260
Use asyncio.run
unkcpz Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']

services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
fail-fast: false

services:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WorkChains support the use of logical constructs such as `If_` and `While_` to c

A `Controller` can control processes throughout their lifetime, by sending and receiving messages. It can launch, pause, continue, kill and check status of the process.

The {py:class}`~plumpy.process_comms.RemoteProcessThreadController` can communicate with the process over the thread communicator provided by {{kiwipy}} which can subscribe and send messages over the {{rabbitmq}} message broker.
The {py:class}`~plumpy.rmq.process_control.RemoteProcessThreadController` can communicate with the process over the thread communicator provided by {{kiwipy}} which can subscribe and send messages over the {{rabbitmq}} message broker.

The thread communicator runs on a independent thread (event loop) and so will not be blocked by sometimes long waiting times in the process event loop.
Using RabbitMQ means that even if the computer is terminated unexpectedly, messages are persisted and can be run once the computer restarts.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
pygments_style = None

intersphinx_mapping = {
'python': ('https://docs.python.org/3.8', None),
'python': ('https://docs.python.org/3.10', None),
'kiwipy': ('https://kiwipy.readthedocs.io/en/latest/', None),
}

Expand Down
4 changes: 2 additions & 2 deletions docs/source/nitpick-exceptions
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ py:class kiwipy.communications.Communicator

# unavailable forward references
py:class plumpy.process_states.Command
py:class plumpy.process_states.State
py:class plumpy.state_machine.State
py:class plumpy.base.state_machine.State
py:class State
py:class Process
py:class plumpy.futures.CancellableAction
py:class plumpy.communications.LoopCommunicator
py:class plumpy.rmq.communications.LoopCommunicator
py:class plumpy.persistence.PersistedPickle
py:class plumpy.utils.AttributesFrozendict
py:class plumpy.workchains._FunctionCall
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"The {py:class}`~plumpy.workchains.WorkChain`\n",
": A subclass of `Process` that allows for running a process as a set of discrete steps (also known as instructions), with the ability to save the state of the process after each instruction has completed.\n",
"\n",
"The process `Controller` (principally the {py:class}`~plumpy.process_comms.RemoteProcessThreadController`)\n",
"The process `Controller` (principally the {py:class}`~plumpy.rmq.process_control.RemoteProcessThreadController`)\n",
": To control the process or workchain throughout its lifetime."
]
},
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ classifiers = [
'License :: OSI Approved :: MIT License',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
keywords = ['workflow', 'multithreaded', 'rabbitmq']
requires-python = '>=3.8'
requires-python = '>=3.10'
dependencies = [
'kiwipy[rmq]~=0.8.5',
'msgpack~=1.1',
'nest_asyncio~=1.5,>=1.5.1',
'pyyaml~=6.0',
'typing-extensions~=4.12'
]

[project.urls]
Expand All @@ -57,8 +57,8 @@ pre-commit = [
]
tests = [
'ipykernel==6.12.1',
'pytest~=7.0',
'pytest-asyncio~=0.12,<0.17',
'pytest~=8.0',
'pytest-asyncio~=0.25',
'pytest-cov~=4.1',
'pytest-notebook>=0.8.0',
'shortuuid==1.0.8',
Expand Down Expand Up @@ -132,6 +132,7 @@ module = [
'aiocontextvars.*',
'frozendict.*',
'kiwipy.*',
'msgpack.*',
'nest_asyncio.*',
'tblib.*',
]
Expand Down Expand Up @@ -162,6 +163,7 @@ testpaths = [
'test',
]
filterwarnings = []
asyncio_default_fixture_loop_scope = "function"

[tool.yapf]
align_closing_bracket_with_visual_indent = true
Expand Down
162 changes: 133 additions & 29 deletions src/plumpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,143 @@
# -*- coding: utf-8 -*-
# mypy: disable-error-code=name-defined
__version__ = '0.24.0'

import logging

from .communications import *
from .events import *
from .exceptions import *
from .futures import *
from .loaders import *
from .mixins import *
from .persistence import *
from .ports import *
from .process_comms import *
from .process_listener import *
from .process_states import *
from .processes import *
from .utils import *
from .workchains import *
from .base.state_machine import TransitionFailed

# interfaces
from .controller import ProcessController
from .coordinator import Coordinator
from .events import (
PlumpyEventLoopPolicy,
get_event_loop,
new_event_loop,
reset_event_loop_policy,
run_until_complete,
set_event_loop,
set_event_loop_policy,
)
from .exceptions import (
ClosedError,
CoordinatorConnectionError,
CoordinatorTimeoutError,
InvalidStateError,
KilledError,
PersistenceError,
UnsuccessfulResult,
)
from .futures import CancellableAction, Future, capture_exceptions, create_task
from .loaders import DefaultObjectLoader, ObjectLoader, get_object_loader, set_object_loader
from .message import Message, MsgContinue, MsgCreate, MsgKill, MsgLaunch, MsgPause, MsgPlay, MsgStatus, ProcessLauncher
from .persistence import (
Bundle,
InMemoryPersister,
LoadSaveContext,
PersistedCheckpoint,
Persister,
PicklePersister,
Savable,
SavableFuture,
auto_persist,
)
from .ports import UNSPECIFIED, InputPort, OutputPort, Port, PortNamespace, PortValidationError
from .process_listener import ProcessListener
from .process_spec import ProcessSpec
from .process_states import (
Continue,
Created,
Excepted,
Finished,
Interruption,
Kill,
Killed,
KillInterruption,
PauseInterruption,
ProcessState,
Running,
Stop,
Wait,
Waiting,
)
from .processes import BundleKeys, Process
from .utils import AttributesDict
from .workchains import ToContext, WorkChain, WorkChainSpec, if_, return_, while_

__all__ = (
events.__all__
+ exceptions.__all__
+ processes.__all__
+ utils.__all__
+ futures.__all__
+ mixins.__all__
+ persistence.__all__
+ communications.__all__
+ process_comms.__all__
+ process_listener.__all__
+ workchains.__all__
+ loaders.__all__
+ ports.__all__
+ process_states.__all__
'UNSPECIFIED',
'AttributesDict',
'Bundle',
'BundleKeys',
'CancellableAction',
'ClosedError',
'Continue',
'Coordinator',
'CoordinatorConnectionError',
'CoordinatorTimeoutError',
'Created',
'DefaultObjectLoader',
'Excepted',
'Finished',
'Future',
'InMemoryPersister',
'InputPort',
'Interruption',
'InvalidStateError',
'Kill',
'KillInterruption',
'Killed',
'KilledError',
'LoadSaveContext',
'Message',
'MsgContinue',
'MsgCreate',
'MsgKill',
'MsgLaunch',
'MsgPause',
'MsgPlay',
'MsgStatus',
'ObjectLoader',
'OutputPort',
'PauseInterruption',
'PersistedCheckpoint',
'PersistenceError',
'Persister',
'PicklePersister',
'PlumpyEventLoopPolicy',
'Port',
'PortNamespace',
'PortValidationError',
'Process',
'ProcessController',
'ProcessLauncher',
'ProcessListener',
'ProcessSpec',
'ProcessState',
'Running',
'Savable',
'SavableFuture',
'Stop',
'ToContext',
'TransitionFailed',
'UnsuccessfulResult',
'Wait',
'Waiting',
'WorkChain',
'WorkChainSpec',
'auto_persist',
'capture_exceptions',
'create_task',
'get_event_loop',
'get_object_loader',
'if_',
'new_event_loop',
'reset_event_loop_policy',
'return_',
'run_until_complete',
'set_event_loop',
'set_event_loop_policy',
'set_object_loader',
'while_',
)


Expand Down
Loading