Is there a way that based upon a fizzled firework one can instruct the firework to re-run itself? I could always dynamically write cases for a firework to re-run itself like so:
def rerun_firework(current_fw, fw_spec, name):
fw_spec['fail_count'] += 1
max_retries = fw_spec['max_retries']
fail_count = fw_spec['fail_count']
if fail_count == max_retries:
# Could not succeed in passing this firework with retries
return FWAction(defuse_workflow=True)
failed_workflow = Workflow.from_Firework(Firework(current_fw, spec=fw_spec, name=name))
return FWAction(detours=[failed_workflow])
Although I am not quite sure that this is the best way of achieving what I am trying to achieve?
Basically I am looking for a way for a Firework to fizzle, as caused by an exception or failure, and then for the firework to retry itself a certain amount of times with changed parameters.