celery / jumpstarter

MIT License
7 stars 3 forks source link

Proposal for restart and init triggers #19

Closed ahopkins closed 3 years ago

ahopkins commented 3 years ago

WIP

ahopkins commented 3 years ago

@thedrow Do we want to go through the regular starting process again?

>>> my_actor.restart()
INFO:transitions.extensions.asyncio:Finished processing state started exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting↦stopping enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting↦stopping exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting↦starting enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting↦starting exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state restarting exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦dependencies_started enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦dependencies_started exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦resources_acquired enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦resources_acquired exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦tasks_started enter callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting↦tasks_started exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state starting exit callbacks.
INFO:transitions.extensions.asyncio:Finished processing state started enter callbacks.
> workflow.state=<ActorState.started: 3>

Or....

ahopkins commented 3 years ago

Also... I was playing with parallel states. I think using children with an initial value makes sense so that the callbacks can be ordered if needed.

thedrow commented 3 years ago

@thedrow Do we want to go through the regular starting process again?

Yes we need to go through the same state transitions for both the shutdown process and the bootup process. This allows us to release all resources, stop all the dependencies and tasks and start them again.

thedrow commented 3 years ago

Also... I was playing with parallel states. I think using children with an initial value makes sense so that the callbacks can be ordered if needed.

If you can produce a state machine that does what you think is right, produce a diagram by inheriting from HierarchicalAnyIOGraphMachine instead of HierarchicalAnyIOMachine and paste it here. Please refer to transitions' documentation for details.

thedrow commented 3 years ago

Fixed by #28.