nirmata / workflow

A ZooKeeper and Curator based distributed workflow management library that enables distributed task workflows.
http://nirmata.github.io/workflow
Apache License 2.0
96 stars 48 forks source link

Closing/shutting down workflow instance one by one gracefully #53

Open gs-msur opened 1 year ago

gs-msur commented 1 year ago

Use case: Suppose we have a fleet of workflow task executor instances picking tasks continuously submitted by the leader node. The tasks in nature can be time taking ones. Now I need to shutdown instances one by one. I need to somehow tell the workflow manager to not pick any further tasks but finish the ones which are in progress.

Problem: I don't want to block all the instances at a time. The other active instances should pick tasks to avoid full down time and extra check of remaining number of tasks to be picked after stopping the submission of new tasks and before closing all the instances.

Probable solution : We can instruct WorkflowManager to shutdown gracefully which in turn will shutdown the executor service in SimpleQueue class with thread await.

Let me know if I have to fork and submit a change if the use case is valid and solution is workable.

gs-msur commented 1 year ago

I might have gone a bit far in the thread. Kindly direct me to solutions if they are already available.