Currently the listener bubbles up exceptions after sending a task failure, which will terminate ActivityWorker.listen().
try:
print(f"Performing {self.activity_name}")
with heartbeat:
task_input = json.loads(task["input"])
output = self.activity_fxn(**task_input)
except (Exception, KeyboardInterrupt) as error:
*_, raw_traceback = sys.exc_info()
formatted_traceback = traceback.format_tb(raw_traceback)
print(f"{self.activity_name} failed!")
self.stepfunctions.send_task_failure(
taskToken=task["taskToken"],
error=str(error)[:256],
cause="\n".join(formatted_traceback),
)
raise
...however, StepFunctions allows you to catch raised exceptions and transition to a different state.
If this is something you are expecting to happen in your Workflow, you shouldn't have to recreate your listener after catching an expected task failure.
Currently the listener bubbles up exceptions after sending a task failure, which will terminate
ActivityWorker.listen()....however, StepFunctions allows you to catch raised exceptions and transition to a different state.
If this is something you are expecting to happen in your Workflow, you shouldn't have to recreate your listener after catching an expected task failure.