Skip to content

Conversation

@gs-msur
Copy link

@gs-msur gs-msur commented Oct 5, 2023

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 someone needs to shutdown instances one by one & tell the workflow manager to not pick any further tasks but finish the ones which are in progress.

Problem: We 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.

@gs-msur
Copy link
Author

gs-msur commented Oct 11, 2023

@Randgalt Can you please review this? The actual issue : [https://github.com//issues/53]

@Randgalt
Copy link
Contributor

I'll try to get to it when I can.

@gs-msur
Copy link
Author

gs-msur commented Apr 5, 2024

@Randgalt It will be great if you can find some time to review this.

public void closeGraceFully(long timeOut, TimeUnit unit) {
if ( started.compareAndSet(true, false) )
{
executorService.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guava has MoreExecutors.shutdownAndAwaitTermination. Consider using it instead.

Copy link
Contributor

@Randgalt Randgalt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 comment about using Guava. Sorry this took so long. I can merge/build after that change assuming you agree.

@gs-msur
Copy link
Author

gs-msur commented Sep 27, 2025

@Randgalt Long time! Sorry I thought this is merged already. Did not see the last comment. I am planning to use this workflow framework for another project now. This graceful shutdown is very important as I am planning to use self managed fleet of workers with graceful deployment process.
I did the suggested change to use Guava executor & tested. This use case is covered and working fine with these changes. Can you find sometime to review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants