In my application I have implemented a very crude workflow made up by 5 different "processing units". The code at the moment is structured like this:

```
def run(self, result_first_step=None, result_second_step=None):

    config = read_workflow_config("config.ini")

    if config.first_step:
        result_first_step = run_process_1()

    if config.second_step and result_first_step is not None:
        result_second_step = run_process_2(result_first_step)
    else:
        raise Exception("Missing required data")

    if config.third_step:
        result_third_step = run_process_3(result_first_step, result_second_step)
    else:
        result_third_step = None

    collect_results(result_first_step, result_second_step, result_third_step)

```

and so on. The code works but it's hardly maintainable and quite fragile (the processing is a lot more complex than this simplified example). So, I've been thinking of adopting another strategy, i.e. making a proper workflow with:

* Short-circuit: I can give no data to the starting process, or two different types of data. In the latter case, the workflow short-circuits and skips some processing
* Common objects: Stuff like configuration available to all units
* Conditions: depending on the configuration, some bits may be skipped

Is there a Python library available to perform these kinds of workflows, or should I roll my own? I've been trying pyutilib.workflow but it doesn't support properly a common configuration object short of passing it around to all workers (tedious).

Notice: this is for a library / command line application, so web-based workflow solutions are not proper.