airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (AIRFLOW-2965) Add CLI command to find the next dag run.
Date Sun, 02 Sep 2018 14:42:01 GMT


ASF GitHub Bot commented on AIRFLOW-2965:

XD-DENG opened a new pull request #3834: [AIRFLOW-2965] CLI tool to show the next execution
   Make sure you have checked _all_ steps below.
   ### Jira
   - [x] My PR addresses the following [Airflow Jira](
issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
     - In case you are fixing a typo in the documentation you can prepend your commit with
\[AIRFLOW-XXX\], code changes always need a Jira issue.
   ### Description
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   This PR is to address the request proposed by JIRA user Jack , in JIRA ticket [2965](
   @r39132 suggested a PR in this ticket.
   This new CLI tool can help show the next execution datetime, given DAG id. Under the hood,
its checking the following schedule of the latest execution datetime.
   Let's say I have DAG `basic_dag` whose schedule_interval is `*/2 * * * *`. The latest execution_date
is 2018-08-31 10:36:00 (start time is 2018-08-31 10:38:00).
   If I run this new CLI tool `airflow next_execution basic_dag`, the result would be 
   <img width="855" alt="screen shot 2018-09-02 at 10 29 05 pm" src="">
   After I change the schedule_interval to `0 23 * * *` and run the same command again, the
result is 
   <img width="868" alt="screen shot 2018-09-02 at 10 30 02 pm" src="">
   **(actual start time would be 2018-09-01 23:00:00)**
   Again, we change the scheduler_interval to `0 3 * * *`, the result is 
   <img width="876" alt="screen shot 2018-09-02 at 10 30 42 pm" src="">
   **(actual start time would be 2018-09-02 03:00:00)**
   Running with `-h` would return the usage and arguments needed.
   <img width="662" alt="screen shot 2018-09-02 at 10 36 14 pm" src="">
   ### Tests
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely
good reason:
   ### Commits
   - [x] My commits all reference Jira issues in their subject lines, and I have squashed
multiple commits if they address the same issue. In addition, my commits follow the guidelines
from "[How to write a good git commit message](":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   ### Documentation
   - [x] In case of new functionality, my PR adds documentation that describes how to use
     - When adding new operators/hooks/sensors, the autoclass documentation generation needs
to be added.
   I believe the documentation generation of CLI is self-contained in script `airflow/bin/`.
   ### Code Quality
   - [x] Passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Add CLI command to find the next dag run.
> -----------------------------------------
>                 Key: AIRFLOW-2965
>                 URL:
>             Project: Apache Airflow
>          Issue Type: Task
>            Reporter: jack
>            Assignee: Xiaodong DENG
>            Priority: Minor
>             Fix For: 1.10.1
> I have a dag with the following properties:
> {code:java}
> dag = DAG(
>     dag_id='mydag',
>     default_args=args,
>     schedule_interval='0 1 * * *',
>     max_active_runs=1,
>     catchup=False){code}
> This runs great.
> Last run is: 2018-08-26 01:00  (start date is 2018-08-27 01:00)
> Now it's 2018-08-27 17:55 I decided to change my dag to:
> {code:java}
> dag = DAG(
>     dag_id='mydag',
>     default_args=args,
>     schedule_interval='0 23 * * *',
>     max_active_runs=1,
>     catchup=False){code}
> Now, I have no idea when will be the next dag run.
> Will it be today at 23:00? I can't be sure when the cycle is complete. I'm not even sure
that this change will do what I wish.
> I'm sure you guys are expert and you can answer this question but most of us wouldn't
> The scheduler has the knowledge when the dag is available for running. All I'm asking
is to take that knowledge and create a CLI command that I will give the dag_id and it will
tell me the next date/hour which my dag will be runnable.

This message was sent by Atlassian JIRA

View raw message