ashb commented on a change in pull request #16030:
URL: https://github.com/apache/airflow/pull/16030#discussion_r646403110
##########
File path: airflow/cli/commands/task_command.py
##########
@@ -42,9 +45,29 @@
get_dags,
suppress_logs_and_warning,
)
+from airflow.utils.dates import timezone
from airflow.utils.log.logging_mixin import StreamLogWriter
from airflow.utils.net import get_hostname
-from airflow.utils.session import create_session
+from airflow.utils.session import create_session, provide_session
+
+
+def _get_ti(dag, task, exec_date_or_run_id):
+ """Get the task instance through DagRun.run_id, if that fails, get the TI
the old way"""
+ dag_run = dag.get_dagrun(run_id=exec_date_or_run_id)
+ if not dag_run:
+ try:
+ execution_date = timezone.parse(exec_date_or_run_id)
+ # print("Warning: execution_date will be removed in
+ # tasks command in the future. Please use DagRun.run_id")
Review comment:
Once we have corrected Airflow itself to use the new version then this
shoudl be printing something (i.e. add this in the "next" PR)
```suggestion
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]