Timeouts for Synchronous and Asynchronous Scripts Execution

When you run embedded Python execution scripts using the REST API, the timeout behavior depends on whether you choose synchronous or asynchronous mode. By default, REST API function endpoint calls operate in synchronous mode.

  • Synchronous Execution: By default, REST API function endpoint calls run in synchronous mode. The REST API function does not set a script execution timeout. However, synchronous calls are bound by the HTTP server timeout, which is typically around 120 seconds. If your script takes longer than this timeout, the server will terminate the connection. If your script may need more time, consider using asynchronous execution.
  • Asynchronous Execution: Use asynchronous mode for scripts that may exceed the synchronous HTTP server timeout of 120 seconds. To enable asynchronous mode, set asyncFlag to true (for example: asyncFlag: true).
    • The default timeout for asynchronous execution is 1800 seconds (30 minutes).
    • You can adjust the timeout by setting the timeout parameter (in seconds).
    For example, to allow up to 7200 seconds (2 hours) for an asynchronous operation, set timeout=7200 in your request:
    curl -i -X POST --header "Authorization: Bearer <token>" \
      --header 'Content-Type: application/json' \
      --header 'Accept: application/json' \
      -d '{"input":"select * from tablename", "parameters":"{\"oml_input_type\":\"pandas.DataFrame\"}", "asyncFlag":true, "timeout":7200}' \
      "<oml-url>/api/py-scripts/v2/table-apply/scriptname"