ashb commented on code in PR #46677:
URL: https://github.com/apache/airflow/pull/46677#discussion_r1958708069
##########
airflow/jobs/triggerer_job_runner.py:
##########
@@ -415,33 +358,177 @@ def handle_failed_triggers(self):
Task Instances that depend on them need failing.
"""
- while self.trigger_runner.failed_triggers:
+ while self.failed_triggers:
# Tell the model to fail this trigger's deps
- trigger_id, saved_exc =
self.trigger_runner.failed_triggers.popleft()
+ trigger_id, saved_exc = self.failed_triggers.popleft()
Trigger.submit_failure(trigger_id=trigger_id, exc=saved_exc)
# Emit stat event
Stats.incr("triggers.failed")
- @add_span
def emit_metrics(self):
- Stats.gauge(f"triggers.running.{self.job.hostname}",
len(self.trigger_runner.triggers))
- Stats.gauge(
- "triggers.running", len(self.trigger_runner.triggers),
tags={"hostname": self.job.hostname}
- )
+ Stats.gauge(f"triggers.running.{self.job.hostname}",
len(self.running_triggers))
+ Stats.gauge("triggers.running", len(self.running_triggers),
tags={"hostname": self.job.hostname})
- capacity_left = self.capacity - len(self.trigger_runner.triggers)
+ capacity_left = self.capacity - len(self.running_triggers)
Stats.gauge(f"triggerer.capacity_left.{self.job.hostname}",
capacity_left)
Stats.gauge("triggerer.capacity_left", capacity_left,
tags={"hostname": self.job.hostname})
span = Trace.get_current_span()
span.set_attributes(
{
"trigger host": self.job.hostname,
- "triggers running": len(self.trigger_runner.triggers),
+ "triggers running": len(self.running_triggers),
"capacity left": capacity_left,
}
)
+ def _send(self, msg: BaseModel):
+ self.stdin.write(msg.model_dump_json().encode("utf-8") + b"\n")
+
+ def update_triggers(self, requested_trigger_ids: set[int]):
+ """
+ Request that we update what triggers we're running.
+
+ Works out the differences - ones to add, and ones to remove - then
+ adds them to the deques so the subprocess can actually mutate the
running
+ trigger set.
+ """
+ render_log_fname = log_filename_template_renderer()
+
+ known_trigger_ids = (
+ self.running_triggers.union(x[0] for x in self.events)
+ .union(self.cancelling_triggers)
+ # .union(x.id for x in self.to_create)
Review Comment:
There is no separate to create list any more, in this class they go straight
in to running set.
I should remove the commented out code 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]