def task_state(self, dag_id, task_id, execution_date): task_state = TaskInstance( DagBag( include_examples=self.include_examples).dags[dag_id].get_task( task_id=task_id), parsedate(execution_date)).current_state() task_state = task_state or "none" return task_state
def get_start_date(suite_data, default=None): """ Tries to find start_date from the reported workflow execution statistics. If we failed to find it, use default from utcnow() """ start_date = utcnow() if default is None else default for test_data in suite_data: try: start_date = parsedate(test_data["message"]["payload"]["statistics"]["total"]["start_date"]) except Exception: pass return start_date