pankajkoti commented on code in PR #31999:
URL: https://github.com/apache/airflow/pull/31999#discussion_r1235308109


##########
airflow/jobs/triggerer_job_runner.py:
##########
@@ -676,11 +676,14 @@ def update_triggers(self, requested_trigger_ids: 
set[int]):
             try:
                 new_trigger_orm = new_triggers[new_id]
                 trigger_class = 
self.get_trigger_by_classpath(new_trigger_orm.classpath)
-            except BaseException as e:
-                # Either the trigger code or the path to it is bad. Fail the 
trigger.
-                self.failed_triggers.append((new_id, e))
+                new_trigger_instance = trigger_class(**new_trigger_orm.kwargs)
+            except (BaseException, TypeError) as err:
+                # BaseException: Either the trigger code or the path to it is 
bad. Fail the trigger.
+                # TypeError: The argument of the __init__ method in the 
trigger might have been changed.
+                self.log.error("Trigger failed; message=%s", err)
+                self.failed_triggers.append((new_id, err))
                 continue
-            new_trigger_instance = trigger_class(**new_trigger_orm.kwargs)

Review Comment:
   I like the approach suggested in 
https://github.com/apache/airflow/pull/31999#discussion_r1234821475 by 
@uranusjr as it states explicitly what errors would be raised and in which 
steps. I agree the exception handling is same in both cases but the approach 
suggested gives more clarity actually when reading the code.
   No strong opinion though :) 



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

Reply via email to