Airflow - "context" dictionary

Note: This post is over 6 years old. The information may be outdated.

Biến context trong airflow là biến hay sử dụng trong Airflow (PythonOperator with a callable function), nhưng mình rất hay quên, note lại đây để dễ dàng tra cứu.

{
      'dag': task.dag,
      'ds': ds,
      'next_ds': next_ds,
      'next_ds_nodash': next_ds_nodash,
      'prev_ds': prev_ds,
      'prev_ds_nodash': prev_ds_nodash,
      'ds_nodash': ds_nodash,
      'ts': ts,
      'ts_nodash': ts_nodash,
      'ts_nodash_with_tz': ts_nodash_with_tz,
      'yesterday_ds': yesterday_ds,
      'yesterday_ds_nodash': yesterday_ds_nodash,
      'tomorrow_ds': tomorrow_ds,
      'tomorrow_ds_nodash': tomorrow_ds_nodash,
      'END_DATE': ds,
      'end_date': ds,
      'dag_run': dag_run,
      'run_id': run_id,
      'execution_date': self.execution_date,
      'prev_execution_date': prev_execution_date,
      'next_execution_date': next_execution_date,
      'latest_date': ds,
      'macros': macros,
      'params': params,
      'tables': tables,
      'task': task,
      'task_instance': self,
      'ti': self,
      'task_instance_key_str': ti_key_str,
      'conf': configuration,
      'test_mode': self.test_mode,
      'var': {
          'value': VariableAccessor(),
          'json': VariableJsonAccessor()
      },
      'inlets': task.inlets,
      'outlets': task.outlets,
}