-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-1424] make the next execution date of DAGs visible #2460
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
Changes from all commits
18daed2
1a8b227
da9b738
f9e734b
e79fdaa
7bea66e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3732,6 +3732,32 @@ def latest_execution_date(self, session=None): | |
| ).scalar() | ||
| return execution_date | ||
|
|
||
| @property | ||
| @provide_session | ||
| def schedulable_at(self, session=None): | ||
| """ | ||
| Returns the earliest time at which the DAG will next be eligible for | ||
| execution by the scheduler | ||
| """ | ||
| from airflow.jobs import SchedulerJob | ||
| scheduler = SchedulerJob() | ||
| next_run_date = scheduler.create_dag_run(self, dry_run=True) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am still getting confused here. You might have already talked about this to @ashb but it would be good if you can clear my doubt. My confusion is the same that Ash mentioned in one of the comments, what is the difference between From the code will it not give the |
||
| if next_run_date: | ||
| period_end = self.following_schedule(next_run_date) | ||
| return period_end | ||
|
|
||
| @property | ||
| def scheduled_in(self): | ||
| """ | ||
| Returns a human readable duration before the next schedulable time | ||
| of the DAG | ||
| """ | ||
| import pendulum | ||
| diff = self.schedulable_at - pendulum.now() | ||
| if diff.in_seconds() <= 0: | ||
| return "overdue" | ||
| return diff | ||
|
|
||
| @property | ||
| def subdags(self): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ultrabug This was my complaint - I don't think we should be calling this method to work out when the next exec date is -- cos this can return None when the dag concurrecy is at it's limit for instance (line 789) and that is the problem. I think it's going to cause confusion that the "scheduled in" column would come-and-go depending on what other runs might be happening.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok @ashb I guess we can work on something to make it better indeed. Your point is not depending on the concurrency limit if I'm correct and display the theorically due schedule in time. Am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @ashb and @ultrabug . Can I help you guys to get this over the line?