You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pratik4891 (via GitHub)" <gi...@apache.org> on 2024/12/12 09:20:30 UTC

[D] Require help to get start date for a schedule [airflow]

GitHub user pratik4891 created a discussion: Require help to get start date for a schedule

Can I please get some help what would be the start date should I provide if I want to start running my job from tomorrow at 3:30 PM and second one at 4:30 PM continuing everyday 


GitHub link: https://github.com/apache/airflow/discussions/44868

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Require help to get start date for a schedule [airflow]

Posted by "enchant3dmango (via GitHub)" <gi...@apache.org>.
GitHub user enchant3dmango added a comment to the discussion: Require help to get start date for a schedule

You should combine the `start_date` and `schedule_interval`.

Try this one:

```python
default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

dag = DAG(
    'dagger',
    default_args=default_args,
    description='Run tasks daily at 3:30 PM and 4:30 PM',
    schedule_interval='30 15,16 * * *',
    start_date=datetime(2024, 12, 30), # If you want it to start tomorrow, set the start_date as D-1 bcoz you want the interval daily
    catchup=False,
)
```

GitHub link: https://github.com/apache/airflow/discussions/44868#discussioncomment-11694534

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Require help to get start date for a schedule [airflow]

Posted by "enchant3dmango (via GitHub)" <gi...@apache.org>.
GitHub user enchant3dmango edited a comment on the discussion: Require help to get start date for a schedule

You should combine the `start_date` and `schedule_interval`.

Try this one:

```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy import DummyOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

with dag as DAG(
    'dagger',
    default_args=default_args,
    description='Run tasks daily at 3:30 PM and 4:30 PM',
    schedule_interval='30 15,16 * * *',
    start_date=datetime(2024, 12, 30), # If you want it to start tomorrow, set the start_date as D-1 bcoz you want the interval daily
    catchup=False,
):
    t1 = DummyOperator(
        task_id='tasker',
    )

    t2 = DummyOperator(
        task_id='tasker',
    )

    t1 >> t2
```

GitHub link: https://github.com/apache/airflow/discussions/44868#discussioncomment-11694534

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Require help to get start date for a schedule [airflow]

Posted by "enchant3dmango (via GitHub)" <gi...@apache.org>.
GitHub user enchant3dmango edited a comment on the discussion: Require help to get start date for a schedule

You should combine the `start_date` and `schedule_interval`.

Try this one:

```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy import DummyOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

dag = DAG(
    'dagger',
    default_args=default_args,
    description='Run tasks daily at 3:30 PM and 4:30 PM',
    schedule_interval='30 15,16 * * *',
    start_date=datetime(2024, 12, 30), # If you want it to start tomorrow, set the start_date as D-1 bcoz you want the interval daily
    catchup=False,
)

task_1 = DummyOperator(
    task_id='t1',
    dag=dag,
)
```

GitHub link: https://github.com/apache/airflow/discussions/44868#discussioncomment-11694534

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Require help to get start date for a schedule [airflow]

Posted by "enchant3dmango (via GitHub)" <gi...@apache.org>.
GitHub user enchant3dmango edited a comment on the discussion: Require help to get start date for a schedule

You should combine the `start_date` and `schedule_interval`.

Try this one:

```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy import DummyOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

with dag as DAG(
    'dagger',
    default_args=default_args,
    description='Run tasks daily at 3:30 PM and 4:30 PM',
    schedule_interval='30 15,16 * * *',
    start_date=datetime(2024, 12, 30), # If you want it to start tomorrow, set the start_date as D-1 bcoz you want the interval daily
    catchup=False,
):

    t1 = DummyOperator(
        task_id='tasker',
    )

    t2 = DummyOperator(
        task_id='tasker',
    )

    t1 >> t2

```

GitHub link: https://github.com/apache/airflow/discussions/44868#discussioncomment-11694534

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org


Re: [D] Require help to get start date for a schedule [airflow]

Posted by "enchant3dmango (via GitHub)" <gi...@apache.org>.
GitHub user enchant3dmango edited a comment on the discussion: Require help to get start date for a schedule

You should combine the `start_date` and `schedule_interval`.

Try this one:

```python
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.dummy import DummyOperator

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

dag = DAG(
    'dagger',
    default_args=default_args,
    description='Run tasks daily at 3:30 PM and 4:30 PM',
    schedule_interval='30 15,16 * * *',
    start_date=datetime(2024, 12, 30), # If you want it to start tomorrow, set the start_date as D-1 bcoz you want the interval daily
    catchup=False,
)

task = DummyOperator(
    task_id='t1',
    dag=dag,
)
```

GitHub link: https://github.com/apache/airflow/discussions/44868#discussioncomment-11694534

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org