Function: sys.sleep

Suspends execution for the given number of seconds.

Maximum is 31536000 (one year).

For more information, see Wait using polling.

Arguments

Arguments
seconds The number of seconds the execution should be suspended for.

Examples

# Poll API until job status is complete
main:
    params: [jobId]
    steps:
      - getJob:  # get job status
          call: http.get
          args:
              url: ${"https://example.com/jobs/" + jobId}
              auth:
                  type: OAuth2
          result: jobStatus
      - checkIfDone:  # check job status
          switch:
            - condition: ${jobStatus.complete}
              return: ${jobStatus}  # stop polling
      - wait:
          call: sys.sleep
          args:
              seconds: 60  # wait 60 seconds
          next: getJob

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.