airflow.models.dagrun
¶
Module Contents¶
-
class
airflow.models.dagrun.
DagRun
[source]¶ Bases:
airflow.models.base.Base
,airflow.utils.log.logging_mixin.LoggingMixin
DagRun describes an instance of a Dag. It can be created by the scheduler (for regular runs) or by an external trigger
-
refresh_from_db
(self, session=None)[source]¶ Reloads the current dagrun from the database :param session: database session
-
static
find
(dag_id=None, run_id=None, execution_date=None, state=None, external_trigger=None, no_backfills=False, session=None)[source]¶ Returns a set of dag runs for the given search criteria.
- Parameters
run_id (str) – defines the the run id for this dag run
execution_date (datetime.datetime) – the execution date
state (str) – the state of the dag run
external_trigger (bool) – whether this dag run is externally triggered
no_backfills (bool) – return no backfills (True), return all (False). Defaults to False
session (sqlalchemy.orm.session.Session) – database session
-
get_task_instances
(self, state=None, session=None)[source]¶ Returns the task instances for this dag run
-
get_task_instance
(self, task_id, session=None)[source]¶ Returns the task instance specified by task_id for this dag run
- Parameters
task_id – the task id
-
get_previous_scheduled_dagrun
(self, session=None)[source]¶ The previous, SCHEDULED DagRun, if there is one
-
update_state
(self, session=None)[source]¶ Determines the overall state of the DagRun based on the state of its TaskInstances.
- Returns
State
-
verify_integrity
(self, session=None)[source]¶ Verifies the DagRun by checking for removed tasks or tasks that are not in the database yet. It will set state to removed or add the task if required.
-