def get_dag_runs(dag_id, state=None):
    """
    Returns a list of Dag Runs for a specific DAG ID.
    :param dag_id: String identifier of a DAG
    :param state: queued|running|success...
    :return: List of DAG runs of a DAG with requested state,
    or all runs if the state is not specified
    """
    dagbag = DagBag()

    # Check DAG exists.
    if dag_id not in dagbag.dags:
        error_message = "Dag id {} not found".format(dag_id)
        raise AirflowException(error_message)

    dag_runs = list()
    state = state.lower() if state else None
    for run in DagRun.find(dag_id=dag_id, state=state):
        dag_runs.append({
            'id': run.id,
            'run_id': run.run_id,
            'state': run.state,
            'dag_id': run.dag_id,
            'execution_date': run.execution_date.isoformat(),
            'start_date': ((run.start_date or '') and
                           run.start_date.isoformat()),
            'dag_run_url': url_for('Airflow.graph', dag_id=run.dag_id,
                                   execution_date=run.execution_date)
        })

    return dag_runs
def get_dag_runs(dag_id, state=None):
    
    dagbag = DagBag()

    
    if dag_id not in dagbag.dags:
        error_message = "Dag id {} not found".format(dag_id)
        raise AirflowException(error_message)

    dag_runs = list()
    state = state.lower() if state else None
    for run in DagRun.find(dag_id=dag_id, state=state):
        dag_runs.append({
            'id': run.id,
            'run_id': run.run_id,
            'state': run.state,
            'dag_id': run.dag_id,
            'execution_date': run.execution_date.isoformat(),
            'start_date': ((run.start_date or '') and
                           run.start_date.isoformat()),
            'dag_run_url': url_for('Airflow.graph', dag_id=run.dag_id,
                                   execution_date=run.execution_date)
        })

    return dag_runs
def get_dag_runs ( dag_id , state = None ) : dagbag = DagBag ( ) # Check DAG exists. if dag_id not in dagbag . dags : error_message = "Dag id {} not found" . format ( dag_id ) raise AirflowException ( error_message ) dag_runs = list ( ) state = state . lower ( ) if state else None for run in DagRun . find ( dag_id = dag_id , state = state ) : dag_runs . append ( { 'id' : run . id , 'run_id' : run . run_id , 'state' : run . state , 'dag_id' : run . dag_id , 'execution_date' : run . execution_date . isoformat ( ) , 'start_date' : ( ( run . start_date or '' ) and run . start_date . isoformat ( ) ) , 'dag_run_url' : url_for ( 'Airflow.graph' , dag_id = run . dag_id , execution_date = run . execution_date ) } ) return dag_runs
Returns a list of Dag Runs for a specific DAG ID.
    :param dag_id: String identifier of a DAG
    :param state: queued|running|success...
    :return: List of DAG runs of a DAG with requested state,
    or all runs if the state is not specified
Returns a list of Dag Runs for a specific DAG ID . : param dag_id : String identifier of a DAG : param state : queued|running|success ... : return : List of DAG runs of a DAG with requested state or all runs if the state is not specified