potiuk commented on a change in pull request #6956: [AIRFLOW-6387] print
details of success/skipped task
URL: https://github.com/apache/airflow/pull/6956#discussion_r363110108
##########
File path: airflow/models/taskinstance.py
##########
@@ -964,11 +964,23 @@ def signal_handler(signum, frame):
self.refresh_from_db(lock_for_update=True)
self.state = State.SUCCESS
except AirflowSkipException as e:
+ # Recording SKIP
# log only if exception has any arguments to prevent log flooding
if e.args:
self.log.info(e)
self.refresh_from_db(lock_for_update=True)
self.state = State.SKIPPED
+ try:
+ self.log.info(
+ 'Marking task as SKIPPED.'
+ 'dag_id=%s, task_id=%s, execution_date=%s, start_date=%s,
end_date=%s',
+ self.dag_id,
+ self.task_id,
+ self.execution_date.strftime('%Y%m%dT%H%M%S') if
self.execution_date else '',
+ self.start_date.strftime('%Y%m%dT%H%M%S') if
self.start_date else '',
+ self.end_date.strftime('%Y%m%dT%H%M%S') if self.end_date
else '')
+ except NameError:
Review comment:
If you use hasattr, you can remove try/except and you will get log in this
case.
----------------------------------------------------------------
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]
With regards,
Apache Git Services