def report_airflow_task_instance( dag_id, execution_date, task_runs, airflow_config=None ): # type: (str, datetime, List[TaskRun], Optional[AirflowConfig]) ->None """ report the relevant airflow task instances to the given task runs """ from dbnd.api.tracking_api import AirflowTaskInfo af_instances = [] for task_run in task_runs: if not task_run.is_reused: # we build airflow infos only for not reused tasks af_instance = AirflowTaskInfo( execution_date=execution_date, dag_id=dag_id, task_id=task_run.task_af_id, task_run_attempt_uid=task_run.task_run_attempt_uid, ) af_instances.append(af_instance) if airflow_config is None: airflow_config = AirflowConfig.from_databand_context() if af_instances and airflow_config.webserver_url: first_task_run = task_runs[0] first_task_run.tracker.tracking_store.save_airflow_task_infos( airflow_task_infos=af_instances, source=UpdateSource.dbnd, base_url=airflow_config.webserver_url, )
def __init__(self, run, task_executor_type, host_engine, target_engine, task_runs): super(AirflowTaskExecutor, self).__init__( run=run, task_executor_type=task_executor_type, host_engine=host_engine, target_engine=target_engine, task_runs=task_runs, ) self.airflow_config = AirflowConfig() self.airflow_task_executor = self._get_airflow_executor() logger.info("Using airflow executor: %s" % self.airflow_task_executor.__class__.__name__)
def __init__(self, run, task_executor_type, host_engine, target_engine, task_runs): super(AirflowTaskExecutor, self).__init__( run=run, task_executor_type=task_executor_type, host_engine=host_engine, target_engine=target_engine, task_runs=task_runs, ) # we want to use reference to AIRFLOW HOME as it can be changed in runtime from dbnd_airflow.bootstrap import dbnd_airflow_bootstrap dbnd_airflow_bootstrap() self.airflow_config = AirflowConfig() self.airflow_task_executor = self._get_airflow_executor() self._validate_airflow_db()