-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement-17725][TaskPlugin] SagemakerTask resource leak repair #17726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request addresses resource leak issues in the SagemakerTask plugin by ensuring proper cleanup of the AWS SageMaker client. The fix adds try-catch-finally blocks to trackApplicationStatus() and cancelApplication() methods to guarantee that client.shutdown() is called even when exceptions occur, preventing resource leaks.
- Adds client cleanup in finally blocks for both
trackApplicationStatus()andcancelApplication()methods - Adds comprehensive unit tests to verify that client shutdown is called even when exceptions are thrown
- Changes
initPipelineId()visibility from private to public to enable test mocking
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| SagemakerTask.java | Wraps trackApplicationStatus() and cancelApplication() logic in try-catch-finally blocks to ensure client.shutdown() is always called, fixing resource leaks |
| SagemakerTaskTest.java | Adds unit tests to verify client.shutdown() is called when exceptions occur in both trackApplicationStatus() and cancelApplication() methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java
Outdated
Show resolved
Hide resolved
...sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java
Show resolved
Hide resolved
...sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java
Outdated
Show resolved
Hide resolved
...sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
...maker/src/test/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTaskTest.java
Outdated
Show resolved
Hide resolved
...maker/src/test/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTaskTest.java
Outdated
Show resolved
Hide resolved
|
Please provide relevant verification before and after the repair. |
Please refer to the details of main issue #14877
fix #17725
Purpose of the pull request
Brief change log
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md