Demonstrates a helper class which relies on workflow.wait_condition to implement a blocking sleep that can be updated at any moment.
The sample is composed of the three executables:
worker.pyhosts the Workflow Executions.starter.pystarts Workflow Executions.wake_up_timer_updater.pySignals the Workflow Execution with the new time to wake up.
First start the Worker:
uv run updatable_timer/worker.pyCheck the output of the Worker window. The expected output is:
Worker started, ctrl+c to exit
Then in a different terminal window start the Workflow Execution:
uv run updatable_timer/starter.pyCheck the output of the Worker window. The expected output is:
Workflow started: run_id=...
Then run the updater as many times as you want to change timer to 10 seconds from now:
uv run updatable_timer/wake_up_time_updater.pyCheck the output of the worker window. The expected output is:
Updated wake up time to 10 seconds from now