Custom Schedule issue with Timetable Plugin #38847
Unanswered
Ashish-Nagdev
asked this question in
Q&A
Replies: 1 comment
-
I was able to change code and following is the code but next_run is incrementing every minute and so jobs are not getting scheduled.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is requirement for Custom DAG schedule. Requirement is as follows-
There are 6 variables(user defined) namely
Custom Schedule requirement is need to identify if it is end of month(eom) or other. end of month(eom) is determined if days_before_eom <= current_date <= days_after_eom then its eom and freq_minutes_workweek_eom needs to be considered if it is workweek(Monday to Friday) or else freq_minutes_weekend_eom needs to be considered if it is weekend (Saturday, Sunday).
If it is not end of month(eom) then freq_minutes_workweek_other or freq_minutes_weekend_other needs to be considered.
Following is the code written, it is registering the timetable plugin class and DAG is able to extend it, however next_run is not getting correct and DAGs are not getting scheduled.
`import logging
from airflow.plugins_manager import AirflowPlugin
from airflow.timetables.base import DagRunInfo, DataInterval, Timetable
from airflow.utils import timezone
from pendulum import DateTime
class CustomSchedule(Timetable):
"""Custom Timetable with configurable schedule based on Airflow variables."""
class CustomTimetablePlugin(AirflowPlugin):
name = "custom_schedule_timetable_plugin"
timetables = [CustomSchedule] # Add the CustomSchedule class to the timetables list
`
Beta Was this translation helpful? Give feedback.
All reactions