airflow.providers.openlineage.plugins.adapter

Module Contents

Classes

OpenLineageAdapter

Translate Airflow metadata to OpenLineage events instead of creating them from Airflow code.

class airflow.providers.openlineage.plugins.adapter.OpenLineageAdapter(client=None, secrets_masker=None)[source]

Bases: airflow.utils.log.logging_mixin.LoggingMixin

Translate Airflow metadata to OpenLineage events instead of creating them from Airflow code.

get_or_create_openlineage_client()[source]
get_openlineage_config()[source]
static build_dag_run_id(dag_id, dag_run_id)[source]
static build_task_instance_run_id(task_id, execution_date, try_number)[source]
emit(event)[source]
start_task(run_id, job_name, job_description, event_time, parent_job_name, parent_run_id, code_location, nominal_start_time, nominal_end_time, owners, task, run_facets=None)[source]

Emits openlineage event of type START.

Parameters
  • run_id (str) – globally unique identifier of task in dag run

  • job_name (str) – globally unique identifier of task in dag

  • job_description (str) – user provided description of job

  • event_time (str) –

  • parent_job_name (str | None) – the name of the parent job (typically the DAG, but possibly a task group)

  • parent_run_id (str | None) – identifier of job spawning this task

  • code_location (str | None) – file path or URL of DAG file

  • nominal_start_time (str | None) – scheduled time of dag run

  • nominal_end_time (str | None) – following schedule of dag run

  • owners (list[str]) – list of owners of DAG

  • task (airflow.providers.openlineage.extractors.OperatorLineage | None) – metadata container with information extracted from operator

  • run_facets (dict[str, openlineage.client.facet.BaseFacet] | None) – custom run facets

complete_task(run_id, job_name, parent_job_name, parent_run_id, end_time, task)[source]

Emits openlineage event of type COMPLETE.

Parameters
  • run_id (str) – globally unique identifier of task in dag run

  • job_name (str) – globally unique identifier of task between dags

  • parent_job_name (str | None) – the name of the parent job (typically the DAG, but possibly a task group)

  • parent_run_id (str | None) – identifier of job spawning this task

  • end_time (str) – time of task completion

  • task (airflow.providers.openlineage.extractors.OperatorLineage) – metadata container with information extracted from operator

fail_task(run_id, job_name, parent_job_name, parent_run_id, end_time, task)[source]

Emits openlineage event of type FAIL.

Parameters
  • run_id (str) – globally unique identifier of task in dag run

  • job_name (str) – globally unique identifier of task between dags

  • parent_job_name (str | None) – the name of the parent job (typically the DAG, but possibly a task group)

  • parent_run_id (str | None) – identifier of job spawning this task

  • end_time (str) – time of task completion

  • task (airflow.providers.openlineage.extractors.OperatorLineage) – metadata container with information extracted from operator

dag_started(dag_run, msg, nominal_start_time, nominal_end_time)[source]
dag_success(dag_run, msg)[source]
dag_failed(dag_run, msg)[source]

Was this entry helpful?