ReferencesPython SDKSteps

Sleep

Sleep for a period of time. Accepts either a datetime.timedelta object or a number of milliseconds.

Arguments

  • Name
    step_id
    Type
    str
    Required
    required
    Description

    Step ID. Should be unique within the function.

  • Name
    duration
    Type
    int | datetime.timedelta
    Required
    required
    Description

    How long to sleep. Can be either a number of milliseconds or a datetime.timedelta object.

Examples

@inngest_client.create_function(
    fn_id="my_function",
    trigger=inngest.TriggerEvent(event="app/my_function"),
)
async def fn(
    ctx: inngest.Context,
    step: inngest.Step,
) -> None:
    await step.sleep("zzz", datetime.timedelta(seconds=2))