Stopping a live flow ends the calls it has running, on workers and in the local pool, and deleting one now ends its local calls too; what a call returns after its flow was stopped or deleted is dropped by a per-flow count the node compares, so a flow started again never takes an old call's answer. A live remote call's id carries a suffix, so two calls of one node no longer share it, and a call is registered before it queues for a slot, so ending its flow or run reaches it and it is never sent; a run's cancel goes through the call's own thread as well
This commit is contained in:
@@ -464,11 +464,12 @@ class Node:
|
||||
|
||||
# A source node asked to inject nothing produces its own data.
|
||||
if not outputs and not self.requires:
|
||||
ended = self._pipeline.ended(self.flow)
|
||||
collected = logs.Collector()
|
||||
with logs.capture(collected):
|
||||
outputs = self.f(params=self.params) or {}
|
||||
if self._pipeline is None:
|
||||
# Its flow was deleted while it ran (`Pipeline.remove_flow`).
|
||||
if self._pipeline is None or self._pipeline.ended(self.flow) != ended:
|
||||
# Its flow was stopped or deleted while it ran.
|
||||
return None
|
||||
self._pipeline.publish_log(self, collected, "")
|
||||
|
||||
@@ -490,7 +491,11 @@ class Node:
|
||||
:returns: Node outputs if successful, or pipeline execution results if bound.
|
||||
:rtype: dict | None
|
||||
"""
|
||||
ended = self._pipeline.ended(self.flow) if self._pipeline is not None else 0
|
||||
outputs = self.execute(inputs)
|
||||
if self._pipeline is None:
|
||||
return outputs
|
||||
if self._pipeline.ended(self.flow) != ended:
|
||||
# Its flow was stopped while it ran.
|
||||
return None
|
||||
return self._pipeline.trigger(self, outputs, durable=durable)
|
||||
|
||||
Reference in New Issue
Block a user