def get_lineage(dag_id: str, execution_date: str): """Get Lineage details for a DagRun""" # Convert string datetime into actual datetime try: execution_dt = timezone.parse(execution_date) except ValueError: error_message = ( 'Given execution date, {}, could not be identified ' 'as a date. Example date format: 2015-11-16T14:34:15+00:00'.format( execution_date)) log.error(error_message) response = jsonify({'error': error_message}) response.status_code = 400 return response try: lineage = get_lineage_api(dag_id=dag_id, execution_date=execution_dt) except AirflowException as err: log.error(err) response = jsonify(error=f"{err}") response.status_code = err.status_code return response else: return jsonify(lineage)
def get_lineage(self, dag_id, execution_date): lineage = get_lineage_api(dag_id=dag_id, execution_date=execution_date) return lineage