Is it possible to change the start_delay on a Temporal workflow in the Python SDK?

We currently start our workflows like below. However, we might want to change the actual start time of our workflow to be sooner or later based on business logic, so I was wondering if it’s possible to update the start_delay on the Temporal workflow. Thanks!

handle = await self._temporal_client.start_workflow(
                        NameOfWorkflow.run,
                        workflow_args,
                        id=str(workflow_id),
                        task_queue="service-name",
                        start_delay=max(
                            instance(transition.timestamp, tz="UTC") - now(tz="UTC"),
                            duration(seconds=0),
                        ),
                    )

The code you posted does not update the delay of an already running workflow. It calculates the delay before starting the workflow. Is it what you want?

Hi @maxim yes, my current code calculates the delay before starting the workflow.

I was wondering after this code runs, is there a way for me to adjust the amount of time delayed before starting the workflow.

There is no currently API for this. The recommended approach is to not use delay but a timer inside the workflow and update the timer based on a signal. See samples-python/updatable_timer at main · temporalio/samples-python · GitHub

1 Like