The sleep module provides functions for pausing execution.

Allowed in

  • build
  • deploy
  • destroy
  • task

Usage

Load the module:

load("github.com/ocuroot/sdk/v0/sleep.star", "sleep")

Example

def deploy():
    # Deploy a service
    print("Deploying service...")
    
    # Wait for service to stabilize
    sleep("30s")
    
    # Run health check
    print("Running health check...")
    
    # Wait between deployment stages
    sleep("1m")
    
    # Continue deployment
    print("Continuing deployment...")

API Reference

sleep(duration)

Pauses execution for the given duration.

Arguments

  • duration: Duration string in the format “Xs” or “Xm” where X is a number
    • Examples: ”30s” for 30 seconds, “1m” for 1 minute, “2m” for 2 minutes

Returns

  • None

Stubs

def sleep(duration):
    pass