How to Run a Simple Airflow DAG

前端 未结 2 1003
名媛妹妹
名媛妹妹 2020-12-28 19:03

I am totally new to Airflow. I would like to run a simple DAG at a specified date. I\'m struggling to make difference between the start date, the execution date, and backfil

相关标签:
2条回答
  • 2020-12-28 19:30

    difference between the start date ,the execution date and backfilling

    Backfilling is done to run DAG explicitly to test/manually run DAG/re run a DAG which error-ed out. You do this using CLI

    airflow backfill -s <<start_date>> <<dag>> 
    #optionally provide -1 as start_date to run it immediately
    

    start_date is, as the name suggests, date from when the DAG definition is valid

    execution_date is the date-time when it is to be run. This you provide while testing individual tasks of DAG as below

    airflow test <<dag>> <<task>> <<exec_date>>
    

    what is the command to run the dag

    Backfill is the command to run DAG explicitly. Otherwise you just put the DAG in the DAGBAG folder and the scheduler will run it as per the schedule defined in the DAG definition

    airflow backfill -s <<start_date>> <<dag>> 
    #optionally provide -1 as start_date to run it immediately
    
    0 讨论(0)
  • 2020-12-28 19:45

    If you run it once with the

    airflow run dag_1 task_1 2017-1-23
    

    The run is saved and running it again won't do anything you can try to re-run it by forcing it

    airflow run --force=true dag_1 task_1 2017-1-23
    

    The airflow backfill command will run any executions that would have run in the time period specified from the start to end date. It will depend what schedule you set on the DAG, if you set it to trigger every hour it should run 24 times, but it also won't re-execute previously executed runs.

    You can clear the task as if it NEVER ran

    airflow clear dag_1 -s 2017-1-23 -e 2017-1-24
    

    Also check the cli docs here: https://airflow.incubator.apache.org/cli.html

    0 讨论(0)
提交回复
热议问题