Skip to main content
You can use pd.flow.suspend and pd.flow.rerun to pause a workflow and resume it later. This is useful when you want to:
  • Pause a workflow until someone manually approves it
  • Poll an external API until some job completes, and proceed with the workflow when it’s done
  • Trigger an external API to start a job, pause the workflow, and resume it when the external API sends an HTTP callback
We’ll cover all of these examples below.

pd.flow.suspend

Use pd.flow.suspend when you want to pause a workflow and proceed with the remaining steps only when manually approved or cancelled. For example, you can suspend a workflow and send yourself a link to manually resume or cancel the rest of the workflow:
def handler(pd: 'pipedream'):
    urls = pd.flow.suspend()
    pd.send.email(
      subject="Please approve this important workflow",
      text=f"Click here to approve the workflow: ${urls["resume_url"]}, and cancel here: ${urls["cancel_url"]}"
    )
    # Pipedream suspends your workflow at the end of the step
You’ll receive an email like this: