astronomer.providers.core.triggers.external_task

Classes

TaskStateTrigger

Waits asynchronously for a task in a different DAG to complete for a

DagStateTrigger

Waits asynchronously for a different DAG to complete for a

ExternalDeploymentTaskTrigger

ExternalDeploymentTaskTrigger Inherits from HttpTrigger and make Async http call to get the deployment state

Module Contents

class astronomer.providers.core.triggers.external_task.TaskStateTrigger(dag_id, task_id, states, execution_dates, poll_interval=5.0)[source]

Bases: airflow.triggers.base.BaseTrigger

Waits asynchronously for a task in a different DAG to complete for a specific logical date.

Parameters:
  • dag_id (str) – The dag_id that contains the task you want to wait for

  • task_id (str) – The task_id that contains the task you want to wait for. If None (default value) the sensor waits for the DAG

  • states (List[str]) – allowed states, default is ['success']

  • execution_dates (List[datetime.datetime])

  • poll_interval (float) – The time interval in seconds to check the state. The default value is 5 sec.

dag_id
task_id
states
execution_dates
poll_interval
serialize()[source]

Serializes TaskStateTrigger arguments and classpath.

async run()[source]

Checks periodically in the database to see if the task exists, and has hit one of the states yet, or not.

count_tasks(session)[source]

Count how many task instances in the database match our criteria.

class astronomer.providers.core.triggers.external_task.DagStateTrigger(dag_id, states, execution_dates, poll_interval=5.0)[source]

Bases: airflow.triggers.base.BaseTrigger

Waits asynchronously for a different DAG to complete for a specific logical date.

Parameters:
  • dag_id (str) – The dag_id that contains the task you want to wait for

  • states (List[str]) – allowed states, default is ['success']

  • execution_dates (List[datetime.datetime]) – The logical date at which DAG run.

  • poll_interval (float) – The time interval in seconds to check the state. The default value is 5.0 sec.

dag_id
states
execution_dates
poll_interval
serialize()[source]

Serializes DagStateTrigger arguments and classpath.

async run()[source]

Checks periodically in the database to see if the dag run exists, and has hit one of the states yet, or not.

count_dags(session)[source]

Count how many dag runs in the database match our criteria.

class astronomer.providers.core.triggers.external_task.ExternalDeploymentTaskTrigger(endpoint, http_conn_id='http_default', method='GET', data=None, headers=None, extra_options=None, poke_interval=5.0)[source]

Bases: astronomer.providers.http.triggers.http.HttpTrigger

ExternalDeploymentTaskTrigger Inherits from HttpTrigger and make Async http call to get the deployment state

serialize()[source]

Serializes ExternalDeploymentTaskTrigger arguments and classpath.

async run()[source]

Makes a series of http calls via an http hook poll for state of the job run until it reaches a failure state or success state. It yields a Trigger if response state is successful.