How to design dag for different scheduler start time

jimmy2019
  1. The problem is

    if task_1(a1.py) run at 1:00 pm daily, task_2(a2.py) run at 5:00 pm daily, task_3 dependents task_1 and task_2.

How to design them in one dag?

  1. I tried that when I set different schedule_interval at a task level, it showed warnings like

    'schedule_interval was on efficacious as dag level '

  2. The code which I have used.

    from datetime import datetime, timedelta
    
    from airflow import DAG
    from airflow import utils
    
    
    
    default_args = {
        'owner': 'airflow',
        'depends_on_past': True,
        'start_date': utils.dates.days_ago(2)
    }
    dag = DAG(DAG_NAME, default_args=default_args)
    
    task_1 = BashOperator(
        task_id='task_1',
        bash_command='python3 a1.py',
        schedule_interval = '0 1 * * *'
        dag=dag,
    )
    
    task_2 = BashOperator(
        task_id='task_2',
        bash_command='python3 a2.py',
        schedule_interval = '0 5 * * *'
        dag=dag,
    )
    
    task_3 = BashOperator(
        task_id='task_3',
        bash_command='python3 a3.py',
        dag=dag,
    )
    
    [task1, task2] >> task3
    
  3. I am expecting this,

    1. task_3 wait for task_1 and task_2 finished, and then start running.
    2. task_1, task2, task_3 must be designed in one dag.
Anup

You add TimeDeltaSensor to wait with timedelta of the minutes between the tasks.

The other option is to create a delaytask using PythonOperator(time.sleep()) or BashOperator(bashcommand='sleep 10m') between the 2 task's.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Airflow: how to schedule a dag to start the day following a weekday?

分類Dev

Reset airflow DAG execution time

分類Dev

How to design a task scheduler in nodejs with rabbitmq that won't run the same task when spanning multiple process?

分類Dev

How to set a flag in docker at the time of start

分類Dev

C#: How to start a thread at a specific time

分類Dev

C#: How to start a thread at a specific time

分類Dev

How to apply different rules for different start_urls in python scrapy?

分類Dev

How to compare start and end time with current time in php?

分類Dev

How to create a survival time variable based on start and stop time

分類Dev

How to compare times in different time zones in Ruby?

分類Dev

how to handle time for different components in pygame

分類Dev

How to add an extra column with different time zone

分類Dev

how to design the xml file coding for different screen size?

分類Dev

How to show ActionList editor from custom TComponentEditor at design time

分類Dev

MySQL- How to implement event scheduler everyday + start from 8am to 10 pm+ every 15 min

分類Dev

How to calculate time difference between start time and end time by group in pandas?

分類Dev

How to start different activity using switch case in the menu item?

分類Dev

How to start different profiles with Google Chrome when startup?

分類Dev

What is task release time in the context of an OS scheduler

分類Dev

How do I grab a process's start time in minutes?

分類Dev

How can I invert the count and set the countdown start time?

分類Dev

How can I track the time pods are waiting to start?

分類Dev

How spark calculates the window start time with given window interval?

分類Dev

How to start applications automatically when Windows starts with a time window

分類Dev

How to Start Service and Stop Service Based on Time Interval in android

分類Dev

How do I get my Activity Indicator to start at the right time?

分類Dev

How is the best way to play an MP3 file with a start time and end time in Python 3

分類Dev

Airflow DAG does not run at specified time with catchup=False

分類Dev

Unable to start firefox to launch a specific page with task scheduler

Related 関連記事

  1. 1

    Airflow: how to schedule a dag to start the day following a weekday?

  2. 2

    Reset airflow DAG execution time

  3. 3

    How to design a task scheduler in nodejs with rabbitmq that won't run the same task when spanning multiple process?

  4. 4

    How to set a flag in docker at the time of start

  5. 5

    C#: How to start a thread at a specific time

  6. 6

    C#: How to start a thread at a specific time

  7. 7

    How to apply different rules for different start_urls in python scrapy?

  8. 8

    How to compare start and end time with current time in php?

  9. 9

    How to create a survival time variable based on start and stop time

  10. 10

    How to compare times in different time zones in Ruby?

  11. 11

    how to handle time for different components in pygame

  12. 12

    How to add an extra column with different time zone

  13. 13

    how to design the xml file coding for different screen size?

  14. 14

    How to show ActionList editor from custom TComponentEditor at design time

  15. 15

    MySQL- How to implement event scheduler everyday + start from 8am to 10 pm+ every 15 min

  16. 16

    How to calculate time difference between start time and end time by group in pandas?

  17. 17

    How to start different activity using switch case in the menu item?

  18. 18

    How to start different profiles with Google Chrome when startup?

  19. 19

    What is task release time in the context of an OS scheduler

  20. 20

    How do I grab a process's start time in minutes?

  21. 21

    How can I invert the count and set the countdown start time?

  22. 22

    How can I track the time pods are waiting to start?

  23. 23

    How spark calculates the window start time with given window interval?

  24. 24

    How to start applications automatically when Windows starts with a time window

  25. 25

    How to Start Service and Stop Service Based on Time Interval in android

  26. 26

    How do I get my Activity Indicator to start at the right time?

  27. 27

    How is the best way to play an MP3 file with a start time and end time in Python 3

  28. 28

    Airflow DAG does not run at specified time with catchup=False

  29. 29

    Unable to start firefox to launch a specific page with task scheduler

ホットタグ

アーカイブ