airflow.providers.openai.triggers.openai

Classes

OpenAIBatchTrigger

Triggers OpenAI Batch API.

Module Contents

class airflow.providers.openai.triggers.openai.OpenAIBatchTrigger(conn_id, batch_id, poll_interval, end_time=None, timeout=None)[source]

Bases: airflow.triggers.base.BaseTrigger

Triggers OpenAI Batch API.

Parameters:
  • conn_id (str) – The OpenAI connection ID to use.

  • batch_id (str) – The ID of the OpenAI batch to wait on.

  • poll_interval (float) – Seconds between batch status polls.

  • timeout (float | None) – Total seconds to wait for the batch to reach a terminal state before giving up. This is the preferred way to bound the wait because the trigger measures elapsed time with time.monotonic(), which is not affected by wall-clock jumps (NTP corrections, DST, container clock skew, VM pause/resume). Either timeout or end_time must be provided.

  • end_time (float | None) – Deprecated. Absolute wall-clock deadline (time.time() based) after which the trigger reports a timeout. Kept for backward compatibility with triggers that were serialized by the previous version of the operator and are still in flight during an upgrade. Prefer timeout for new code.

conn_id[source]
poll_interval[source]
batch_id[source]
end_time = None[source]
timeout = None[source]
serialize()[source]

Serialize OpenAIBatchTrigger arguments and class path.

The trigger stores exactly the argument it was constructed with (timeout or end_time) so that a rolling upgrade never rewrites the schema of an in-flight deferred trigger.

async run()[source]

Make connection to OpenAI Client, and poll the status of batch.

Was this entry helpful?