uranusjr commented on a change in pull request #22666:
URL: https://github.com/apache/airflow/pull/22666#discussion_r840262850
##########
File path: airflow/cli/commands/dag_command.py
##########
@@ -276,6 +277,17 @@ def dag_next_execution(args):
if dag.get_is_paused():
print("[INFO] Please be reminded this DAG is PAUSED now.",
file=sys.stderr)
+ if args.respect_catchup:
+ dag_run = DagRun(execution_date=datetime.utcnow())
+ next_info =
dag.next_dagrun_info(dag.get_run_data_interval(dag_run), restricted=False)
+ print(next_info.logical_date.isoformat())
+ return
+ elif not dag.catchup and not args.respect_catchup:
+ print(
+ "[INFO] Please be reminded this DAG has catchup=False."
+ "if you would like to base command off current time pass -r
flag",
+ file=sys.stderr,
+ )
Review comment:
I think instead of consistently telling the user about this, we should
gradually deprecate the current behaviour, trasition most people to the new
behaviour, but still allow the user to explicitly specify the current behaviour
without being further disturbed.
So I think we should add two [mutually exclusive
options](https://docs.python.org/3/library/argparse.html#mutual-exclusion):
`--respect-catchup` and `--no-respect-catchup`, and
1. If `--respect-catchup` is specified, use the new behaviour.
2. If `--no-repsect-catchup` is specified, use the current behaviour.
3. If neither is specified, use the current behaviour, _and emit a
deprecation warning_ describing this does not respect the catchup setting, the
behaviour will change in Airflow 3.0, and the user is advised to explicitly
pass either argument to suppress the warning.
By the way, the `-r` shorthand does not seem right to me because the main
thing about the options is _catchup_, not _respect_; I’d say let’s **not** add
a shorthand for now, we can always do that later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]