turbaszek commented on a change in pull request #8466:
URL: https://github.com/apache/airflow/pull/8466#discussion_r412885861



##########
File path: airflow/sensors/base_sensor_operator.py
##########
@@ -119,9 +119,11 @@ def execute(self, context: Dict) -> Any:
                 # This gives the ability to set up non-blocking AND soft-fail 
sensors.
                 if self.soft_fail and not context['ti'].is_eligible_to_retry():
                     self._do_skip_downstream_tasks(context)
-                    raise AirflowSkipException('Snap. Time is OUT.')
+                    raise AirflowSkipException(
+                        "Snap. Time is OUT. {d}".format(d=self.dag.dag_id if 
self.has_dag() else ""))
                 else:
-                    raise AirflowSensorTimeout('Snap. Time is OUT.')
+                    raise AirflowSensorTimeout(
+                        "Snap. Time is OUT. {d}".format(d=self.dag.dag_id if 
self.has_dag() else ""))

Review comment:
       What would you say to extract dag id to a value and avoid duplication?
   ```python
   log_dag_id = self.dag.dag_id if self.has_dag() else ""
   if ...:
       ...
       raise AirflowSkipException(f"Snap. Time is OUT. DAG id: {log_dag_id}")
   ```




----------------------------------------------------------------
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]


Reply via email to