Exemplo n.º 1
0
    def handle_callback(self, *args, **kwargs):
        self.log.debug(f"handle_callback({args}, {kwargs})")
        try:
            dagrun = args[0]
            self.log.debug(f"handle_callback() dagrun : {dagrun}")
            _MARQUEZ.create_namespace()
            self._report_task_instances(dagrun,
                                        DagUtils.get_run_args(**kwargs),
                                        kwargs.get('session'))
        except Exception as e:
            self.log.error(
                f'Failed to record dagrun callback: {e} '
                f'dag_id={self.dag_id}',
                exc_info=True)

        return super().handle_callback(*args)
Exemplo n.º 2
0
    def create_dagrun(self, *args, **kwargs):
        # run Airflow's create_dagrun() first
        dagrun = super(DAG, self).create_dagrun(*args, **kwargs)

        create_dag_start_ms = self._now_ms()
        try:
            _MARQUEZ.create_namespace()
            self._register_dagrun(dagrun,
                                  DagUtils.get_execution_date(**kwargs),
                                  DagUtils.get_run_args(**kwargs))
        except Exception as e:
            self.log.error(
                f'Failed to record metadata: {e} '
                f'{self._timed_log_message(create_dag_start_ms)}',
                exc_info=True)

        return dagrun