Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show DAG parse error if 'timetable' and 'schedule_interval' are set together #23087

Closed
1 of 2 tasks
sdebruyn opened this issue Apr 19, 2022 · 5 comments
Closed
1 of 2 tasks
Assignees
Labels

Comments

@sdebruyn
Copy link
Contributor

Apache Airflow version

2.2.5 (latest released)

What happened

In the UI I see 1 day, 00:00:00 under Schedule instead of the summary I've defined in my timetable:

    @property
    def summary(self) -> str:
        return "Daily (DailyTimetable)"

What you think should happen instead

According to the docs, overriding summary should change how the timetable is represented in the UI: https://airflow.apache.org/docs/apache-airflow/stable/howto/timetable.html#timetable-display-in-ui

How to reproduce

from airflow.timetables.base import DagRunInfo, DataInterval, TimeRestriction, Timetable


class DailyTimetable(Timetable):

    @property
    def summary(self) -> str:
        return "Daily (DailyTimetable)"

I can't share our implementation of this timetable, but I added the relevant code for the summary that is deployed.

Operating System

docker image apache/airflow:2.2.5-python3.9

Versions of Apache Airflow Providers

Apache Airflow 2.2.5

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@sdebruyn sdebruyn added area:core kind:bug This is a clearly a bug labels Apr 19, 2022
@sdebruyn
Copy link
Contributor Author

My bad, I accidentally set the schedule interval as well

@uranusjr
Copy link
Member

Let me add an error for this so you don’t stumble on it again.

@uranusjr uranusjr reopened this Apr 19, 2022
@uranusjr uranusjr added kind:feature Feature Requests and removed kind:bug This is a clearly a bug labels Apr 19, 2022
@uranusjr uranusjr self-assigned this Apr 19, 2022
@uranusjr uranusjr changed the title Airflow UI doesn't show timetable summary Show DAG parse error if 'timetable' and 'schedule_interval' are set together Apr 19, 2022
@uranusjr
Copy link
Member

Actually it seems like we already have an exception?

>>> from airflow import DAG
>>> from airflow.timetables.simple import NullTimetable
>>> DAG("my-dag", schedule_interval="@once", timetable=NullTimetable())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/airflow/airflow/models/dag.py", line 426, in __init__
    raise TypeError("cannot specify both 'schedule_interval' and 'timetable'")
TypeError: cannot specify both 'schedule_interval' and 'timetable'

@sdebruyn
Copy link
Contributor Author

It wasn't triggered for me since I set the timetable after the init

@uranusjr
Copy link
Member

Modifying a DAG after it’s declared is not recommended or actively supported, so you should avoid that anyway. I’ll still add something to guard this, but don’t count for the validation to be fool-proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants