Question: I need to manage a large workflow of ETL tasks, which execution depends on time, data availability or an external event. Some jobs may fail during execution of the workflow and the system should have the ability to restart a failed workflow branch without waiting for whole workflow to finish execution.

Are there any frameworks in python that can handle this?

I see several core functions:

* DAG bulding
* Execution of nodes (run shell cmd with wait,logging etc.)
* Ability to rebuild sub-graph in parent DAG during execution
* Ability to manual execute nodes or sub-graph while parent graph is running
* Suspend graph execution while waiting for external event
* List job queue and job details

Something like [Oozie](http://oozie.apache.org), but more general purpose and in python.

Answer: 
1) You can give [dagobah](https://github.com/thieman/dagobah) a try, as described on its github page: Dagobah is a simple dependency-based job scheduler written in Python. Dagobah allows you to schedule periodic jobs using Cron syntax. Each job then kicks off a series of tasks (subprocesses) in an order defined by a dependency graph you can easily draw with click-and-drag in the web interface. This is the most lightweight scheduler project comparing with the three followings.

![dagobah's web interface](https://i.stack.imgur.com/2f1kO.png)

2) In terms of ETL tasks, [luigi](https://github.com/spotify/luigi) which is open sourced by Spotify focus more on hadoop jobs, as described: Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in. 

![luigi's web interface](https://i.stack.imgur.com/xFUmZ.png)

Both of the two modules are mainly written in Python and web interfaces are included for convenient management. 

As far as I know, 'luigi' doesn't provide a scheduler module for job tasks, which I think is necessary for ETL tasks. But using 'luigi' is more easy to write map-reduce code in Python and thousands of tasks every day at Spotify run depend on it.

3) Like luigi, Pinterest open sourced their a workflow manager named [Pinball](https://github.com/pinterest/pinball). Pinball’s architecture follows a master-worker (or master-client to avoid naming confusion with a special type of client that we introduce below) paradigm where the stateful central master acts as a source of truth about the current system state to stateless clients. And it integrate hadoop/hive/spark jobs smoothly.

![pinball's web interface](https://i.stack.imgur.com/HZJ0y.png)

4) [Airflow](https://github.com/airbnb/airflow), yet another dag job schedule project open sourced by Airbnb, is quite like Luigi and Pinball. The backend is build on Flask, Celery and so on. According to the [example job code](https://github.com/airbnb/airflow/tree/master/airflow/example_dags), Airflow is both powerful and easy to use by my side.

![airflow's web interface](https://i.stack.imgur.com/iVNcu.png)

Last but not least, Luigi, Airflow and Pinball may be more widely used. And there is a great comparison among these three: <http://bytepawn.com/luigi-airflow-pinball.html>
There are a ton of these; everyone seems to write their own. There is a good list at <https://github.com/common-workflow-language/common-workflow-language/wiki/Existing-Workflow-systems>. Which includes systems that originate in both industry and academia.