How to rerun a failed workflow in Fireworks ?

Fireworks workflow engine provides a command ‘lpad’ to perform various operations like listing all workflows, rerun a workflow, etc

However, if you need to rerun a failed workflow from your Python code, then you have to implement a simple function as below:

rerun_workflow.py

from fireworks.core.launchpad import Launchpad
def rerun_workflow(workflow_id):
    host = '127.0.0.1'
    port = '12345'
    db_name = 'hello'
    lpad = LaunchPad(host=host, port=port, name=db_name)
    wf = lpad.get_wf_summary_dict(workflow_id, mode='more')
    wf_states = wf['states']
    for wf_name,wf_state in wf_states.items():
        if wf_state == 'FIZZLED':
            fizzled_fw_id = wf_name.split('--')[-1]
            lpad.rerun_fw(int(fizzled_fw_id))
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s