airflow_config.DAG¶
- class airflow_config.DAG(config: Configuration = None, **kwargs)[source]¶
Bases:
DAG- __init__(config: Configuration = None, **kwargs)[source]¶
Methods
__init__([config])add_task(task)Add a task to the DAG.
add_tasks(tasks)Add a list of tasks to the DAG.
bulk_sync_to_db(dags[, session])Use airflow.models.DAG.bulk_write_to_db, this method is deprecated.
bulk_write_to_db(dags[, processor_subdir, ...])Ensure the DagModel rows for the given dags are up-to-date in the dag table in the DB.
clear([task_ids, start_date, end_date, ...])Clear a set of task instances associated with the current dag for a specified date range.
clear_dags(dags[, start_date, end_date, ...])cli()Exposes a CLI specific to this DAG.
create_dagrun(state[, execution_date, ...])Create a dag run from this dag including the tasks associated with this dag.
date_range(start_date[, num, end_date])deactivate_stale_dags(expiration_date[, session])Deactivate any DAGs that were last touched by the scheduler before the expiration date.
deactivate_unknown_dags(active_dag_ids[, ...])Given a list of known DAGs, deactivate any other DAGs that are marked as active in the ORM.
execute_callback(callbacks, context, dag_id)Triggers the callbacks with the given context.
fetch_callback(dag, dag_run_id[, success, ...])Fetch the appropriate callbacks depending on the value of success.
fetch_dagrun(dag_id[, execution_date, ...])Return the dag run for a given execution date or run_id if it exists, otherwise none.
following_schedule(dttm)Calculate the following schedule for this dag in UTC.
get_active_runs()Return a list of dag run execution dates currently running.
get_concurrency_reached([session])Return a boolean indicating whether the max_active_tasks limit for this DAG has been reached.
get_dagrun([execution_date, run_id, session])get_dagruns_between(start_date, end_date[, ...])Return the list of dag runs between start_date (inclusive) and end_date (inclusive).
get_default_view()Allow backward compatible jinja2 templates.
get_doc_md(doc_md)get_edge_info(upstream_task_id, ...)Return edge information for the given pair of tasks or an empty edge if there is no information.
get_is_active([session])Return a boolean indicating whether this DAG is active.
get_is_paused([session])Return a boolean indicating whether this DAG is paused.
get_last_dagrun([session, ...])get_latest_execution_date([session])Return the latest date for which at least one dag run exists.
get_next_data_interval(dag_model)Get the data interval of the next scheduled run.
get_num_active_runs([external_trigger, ...])Return the number of active "running" dag runs.
get_num_task_instances(dag_id[, run_id, ...])Return the number of task instances in the given DAG.
get_run_data_interval(run)Get the data interval of this run.
get_run_dates(start_date[, end_date])Return a list of dates between the interval received as parameter using this dag's schedule interval.
get_serialized_fields()Stringified DAGs and operators contain exactly these fields.
get_task(task_id[, include_subdags])get_task_instances([start_date, end_date, ...])get_task_instances_before(base_date, num, *)Get
numtask instances before (including)base_date.get_template_env(*[, force_sandboxed])Build a Jinja2 environment.
get_tree_view()Return an ASCII tree representation of the DAG.
handle_callback(dagrun[, success, reason, ...])Triggers on_failure_callback or on_success_callback as appropriate.
has_dag_runs([session, ...])has_task(task_id)has_task_group(task_group_id)infer_automated_data_interval(logical_date)Infer a data interval for a run against this DAG.
is_fixed_time_schedule()Figures out if the schedule has a fixed time (e.g. 3 AM every day).
iter_dagrun_infos_between(earliest, latest, *)Yield DagRunInfo using this DAG's timetable between given interval.
iter_invalid_owner_links()Parse a given link, and verifies if it's a valid URL, or a 'mailto' link.
logger()Return a logger.
next_dagrun_after_date(...)next_dagrun_info(last_automated_dagrun, *[, ...])Get information about the next DagRun of this dag after
date_last_automated_dagrun.normalize_schedule(dttm)param(name[, default])Return a DagParam object for current dag.
partial_subset(task_ids_or_regex[, ...])Return a subset of the current dag based on regex matching one or more tasks.
pickle([session])pickle_info()previous_schedule(dttm)resolve_template_files()run([start_date, end_date, mark_success, ...])Run the DAG.
set_dag_runs_state([state, session, ...])set_dependency(upstream_task_id, ...)Set dependency between two tasks that already have been added to the DAG using add_task().
set_edge_info(upstream_task_id, ...)Set the given edge information on the DAG.
set_task_group_state(*, group_id[, ...])Set TaskGroup to the given state and clear downstream tasks in failed or upstream_failed state.
set_task_instance_state(*, task_id[, ...])Set the state of a TaskInstance and clear downstream tasks in failed or upstream_failed state.
sub_dag(*args, **kwargs)Use airflow.models.DAG.partial_subset, this method is deprecated.
sync_to_db([processor_subdir, session])Save attributes about this DAG to the DB.
test([execution_date, run_conf, ...])Execute one single DagRun for a given DAG and execution date.
topological_sort([include_subdag_tasks])Sorts tasks in topographical order, such that a task comes after any of its upstream dependencies.
tree_view()Print an ASCII tree representation of the DAG.
validate()Validate the DAG has a coherent setup.
validate_executor_field()validate_schedule_and_params()Validate Param values when the DAG has schedule defined.
validate_setup_teardown()Validate that setup and teardown tasks are configured properly.
Attributes
access_controlallow_future_exec_datesconcurrencyconcurrency_reachedUse airflow.models.DAG.get_concurrency_reached, this attribute is deprecated.
dag_display_namedag_iddefault_viewdescriptionfilepathRelative file path to the DAG.
folderFolder location of where the DAG object is instantiated.
full_filepathFull file path to the DAG.
is_pausedUse airflow.models.DAG.get_is_paused, this attribute is deprecated.
is_subdaglatest_execution_dateUse airflow.models.DAG.get_latest_execution_date, this attribute is deprecated.
leavesReturn nodes with no children.
logReturn a logger.
max_active_tasksnormalized_schedule_intervalownerReturn list of all owners found in DAG tasks.
parent_dagpickle_idrelative_filelocFile location of the importable dag 'file' relative to the configured DAGs folder.
rootsReturn nodes with no parents.
subdagsReturn a list of the subdag objects associated to this DAG.
tasktask_grouptask_group_dicttask_idstaskstasks_upstream_of_teardownsteardownsfilelocFile path that needs to be imported to load this DAG or subdag.