pd.flow.delay
to delay a step in a workflow.
These docs show you how to write Python code to handle delays. If you don’t need to write code, see our built-in delay actions.
pd.flow.delay
pd.flow.delay
takes one argument: the number of milliseconds you’d like to pause your workflow until the next step executes. .
Note that delays happen at the end of the step where they’re called.
pd.flow.delay
is executed in a Python step, the workflow itself will enter a Paused state.While the workflow is paused, it will not incur any credits towards compute time. You can also view all paused workflows in the Event History.pd.flow.delay
does not impact your credit usage. For example, delaying a 256 megabyte workflow for five minutes will not incur ten credits.
However, using pd.flow.delay
in a workflow will incur two credits.
One credit is used to initially start the workflow, then the second credit is used when the workflow resumes after its pause period has ended.
pd.flow.delay
.cancel_url
and resume_url
pd.flow.delay
return a cancel_url
and resume_url
that lets you cancel or resume paused executions.
These URLs are specific to a single execution of your workflow. While the workflow is paused, you can load these in your browser or send an HTTP request to either:
cancel_url
will immediately cancel that executionresume_url
will immediately resume that execution earlypd.flow.delay
, you can send these URLs to third party systems, via email, or anywhere else you’d like to control the execution of your workflow.
pd.send.email
, the html
argument defaults to ""
, so it overrides the email text
unless explicitly set to None
.pd.flow.delay
. This lets you send the cancel_url
and resume_url
to third-party systems.
pd.respond
after running pd.flow.delay
. Pipedream ends the original execution of the workflow when pd.flow.delay
is called and issues the following response to the client to indicate this state:
$.respond() not called for this invocationIf you need to set a delay on an HTTP request triggered workflow, consider using
time.sleep
instead.
time.sleep
time.sleep
instead of using pd.flow.delay
to delay individual workflow steps.
However, there are some drawbacks to using time.sleep
instead of pd.flow.delay
. time.sleep
will count towards your workflow’s compute time, for example: