[GOBBLIN-2254] Add timeout in gobblintaskrunner shutdown and move metrics reporting …#4173
Merged
Blazer-007 merged 2 commits intoapache:masterfrom Mar 11, 2026
Conversation
…shutdown after stopping helix task closing
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable timeout for TaskStateModelFactory shutdown in GobblinTaskRunner and reorders the shutdown sequence so that metrics reporting is stopped after tasks have completed and emitted their final Gobblin Tracking Events (GTEs).
Changes:
- Added a new configuration key
gobblin.cluster.taskStateModelFactory.shutdownTimeoutSeconds(default: 300s) inGobblinClusterConfigurationKeys. - Refactored
GobblinTaskRunner.stop()to move metrics shutdown after task state model factory shutdown and Helix disconnection, and introduced ashutdownTaskStateModelFactory()method that polls for graceful termination with a configurable timeout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterConfigurationKeys.java |
Added new configuration constants for task state model factory shutdown timeout |
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinTaskRunner.java |
Added timeout field, reordered shutdown sequence to delay metrics stop, and added shutdownTaskStateModelFactory() helper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinTaskRunner.java
Outdated
Show resolved
Hide resolved
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterConfigurationKeys.java
Show resolved
Hide resolved
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinTaskRunner.java
Outdated
Show resolved
Hide resolved
abhishekmjain
approved these changes
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…shutdown after stopping helix task closing
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
This pull request introduces a configurable shutdown timeout for the
TaskStateModelFactoryin the Gobblin cluster, enhancing the shutdown behavior of theGobblinTaskRunner. The main goal is to allow the system to wait for a graceful termination of the task state model factory, with a configurable timeout, before shutting down metrics and other services.Key changes:
Configuration Enhancements:
taskStateModelFactory.shutdownTimeoutSecondswith a default value of 300 seconds toGobblinClusterConfigurationKeys, allowing users to specify the shutdown timeout for theTaskStateModelFactory.GobblinTaskRunner Improvements:
taskStateModelFactoryShutdownTimeoutSecondsinGobblinTaskRunnerand initialized it from the configuration, enabling the use of the new shutdown timeout setting. [1] [2]stop()method to:taskStateModelFactorywith a newshutdownTaskStateModelFactory()method that waits up to the configured timeout for graceful termination, logging a warning if the timeout is exceeded.shutdownTaskStateModelFactory()helper method, which implements the timeout logic and handles thread interruption gracefully.Tests
Test already exist
GobblinTaskRunnerTest::testSendReceiveShutdownMessageCommits