Blazer-007 opened a new pull request, #4173: URL: https://github.com/apache/gobblin/pull/4173
…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 - [ ] My PR addresses the following [Gobblin JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR" - https://issues.apache.org/jira/browse/GOBBLIN-2254 ### Description - [ ] Here are some details about my PR, including screenshots (if applicable): This pull request introduces a configurable shutdown timeout for the `TaskStateModelFactory` in the Gobblin cluster, enhancing the shutdown behavior of the `GobblinTaskRunner`. 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:** * Added new configuration key `taskStateModelFactory.shutdownTimeoutSeconds` with a default value of 300 seconds to `GobblinClusterConfigurationKeys`, allowing users to specify the shutdown timeout for the `TaskStateModelFactory`. **GobblinTaskRunner Improvements:** * Introduced a new field `taskStateModelFactoryShutdownTimeoutSeconds` in `GobblinTaskRunner` and initialized it from the configuration, enabling the use of the new shutdown timeout setting. [[1]](diffhunk://#diff-2eeaf4d175309215a17c4c0d83e4a2f41170b582ed4c951f556d32eccd5588aaR180) [[2]](diffhunk://#diff-2eeaf4d175309215a17c4c0d83e4a2f41170b582ed4c951f556d32eccd5588aaR217-R220) * Refactored the shutdown sequence in the `stop()` method to: - Move metrics shutdown after task completion to ensure all final events are emitted. - Replace direct shutdown of `taskStateModelFactory` with a new `shutdownTaskStateModelFactory()` method that waits up to the configured timeout for graceful termination, logging a warning if the timeout is exceeded. * Added the `shutdownTaskStateModelFactory()` helper method, which implements the timeout logic and handles thread interruption gracefully. ### Tests - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason: Test already exist `GobblinTaskRunnerTest::testSendReceiveShutdownMessage` ### Commits - [ ] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)": 1. Subject is separated from body by a blank line 2. Subject is limited to 50 characters 3. Subject does not end with a period 4. Subject uses the imperative mood ("add", not "adding") 5. Body wraps at 72 characters 6. Body explains "what" and "why", not "how" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
