in jbi/runner.py [0:0]
def __call__(self, context: ActionContext) -> ActionResult:
"""Called from `runner` when the action is used."""
has_produced_request = False
for step in self.steps[context.operation]:
context = context.update(current_step=step.__name__)
step_kwargs = self.build_step_kwargs(step)
try:
result, context = step(context=context, **step_kwargs)
if result == StepStatus.SUCCESS:
statsd.incr(f"jbi.steps.{step.__name__}.count")
elif result == StepStatus.INCOMPLETE:
# Step did not execute all its operations.
statsd.incr(
f"jbi.action.{context.action.whiteboard_tag}.incomplete.count"
)
except Exception:
if has_produced_request:
# Count the number of workflows that produced at least one request,
# but could not complete entirely with success.
statsd.incr(
f"jbi.action.{context.action.whiteboard_tag}.aborted.count"
)
raise
step_responses = context.responses_by_step[step.__name__]
if step_responses:
has_produced_request = True
for response in step_responses:
logger.info(
"Received %s",
response,
extra={
"response": response,
**context.model_dump(),
},
)
# Flatten the list of all received responses.
responses = list(
itertools.chain.from_iterable(context.responses_by_step.values())
)
return True, {"responses": responses}