Skip to content
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

Deabstract savable interface #33

Open
wants to merge 24 commits into
base: fork
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6ce23b2
Explict module import list in __init__.py (#8)
unkcpz Jan 18, 2025
dd17ccc
Remove the middle layer of statemachine.State + Savable abstraction
unkcpz Dec 2, 2024
a684daf
Move is_terminal as class attribute required
unkcpz Dec 2, 2024
f023e9c
forming the enter/exit for State protocol
unkcpz Dec 2, 2024
50d7f65
Forming Interruptable and Proceedable protocol
unkcpz Dec 2, 2024
a111cd8
Refactoring create_state as static function initialize state from label
unkcpz Dec 2, 2024
11f7518
To lenthy for rethinking
unkcpz Dec 4, 2024
da45d60
Move static method load outside
unkcpz Dec 4, 2024
3993e4c
save_instance_state simplify to only has save interface
unkcpz Dec 9, 2024
dab66cc
load_instance_state deabstract simplify
unkcpz Dec 9, 2024
4bf5e99
ProcessListener recreate_from
unkcpz Dec 9, 2024
cc80a0b
Absorb all load_instance_state into recreate_from
unkcpz Dec 9, 2024
efb322b
Remove useless persist method of Savable class
unkcpz Dec 9, 2024
94590a6
Explicity recreate_from implementation
unkcpz Dec 9, 2024
90848fa
forming Savable protocol
unkcpz Dec 9, 2024
d5680d7
Make auto_load symmetry with auto_save and state/state_label distinguish
unkcpz Dec 10, 2024
4195247
misc rebase
unkcpz Jan 18, 2025
4f6a2bb
debug logger when state change
unkcpz Jan 18, 2025
15ce0fe
logger for load process from context
unkcpz Jan 18, 2025
845a7d6
Using typing-extensions for 3.9 support of @override
unkcpz Jan 22, 2025
0a3b65e
Merge branch 'fork' into deab-savable-inh
unkcpz Feb 5, 2025
94e7fe2
Merge branch 'fork' into deab-savable-inh
unkcpz Feb 5, 2025
897a5c4
Merge branch 'fork' into deab-savable-inh
unkcpz Feb 11, 2025
76c887f
mis
unkcpz Feb 12, 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 docs/source/nitpick-exceptions
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies = [
'kiwipy[rmq]~=0.8.5',
'nest_asyncio~=1.5,>=1.5.1',
'pyyaml~=6.0',
'typing-extensions~=4.12'
]

[project.urls]
Expand Down
160 changes: 131 additions & 29 deletions src/plumpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,144 @@
# -*- coding: utf-8 -*-
# mypy: disable-error-code=name-defined
__version__ = '0.24.0'

import logging

from .base.state_machine import TransitionFailed

# interfaces
from .controller import ProcessController
from .coordinator import Coordinator
from .events import *
from .exceptions import *
from .futures import *
from .loaders import *
from .message import *
from .mixins import *
from .persistence import *
from .ports import *
from .process_listener import *
from .process_states import *
from .processes import *
from .rmq import *
from .utils import *
from .workchains import *
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
from .loaders import DefaultObjectLoader, ObjectLoader, get_object_loader, set_object_loader
from .message import 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__
+ message.__all__
+ process_listener.__all__
+ workchains.__all__
+ loaders.__all__
+ ports.__all__
+ process_states.__all__
) + ['ProcessController', 'Coordinator']
'UNSPECIFIED',
'AttributesDict',
'Bundle',
'BundleKeys',
'CancellableAction',
'ClosedError',
'Continue',
'Coordinator',
'CoordinatorConnectionError',
'CoordinatorTimeoutError',
'Created',
'DefaultObjectLoader',
'Excepted',
'Finished',
'Future',
'InMemoryPersister',
'InputPort',
'Interruption',
'InvalidStateError',
'Kill',
'KillInterruption',
'Killed',
'KilledError',
'LoadSaveContext',
'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_continue_body',
'create_launch_body',
'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_',
)


# Do this se we don't get the "No handlers could be found..." warnings that will be produced
Expand Down
Loading