niumy0701 commented on code in PR #17726:
URL:
https://github.com/apache/dolphinscheduler/pull/17726#discussion_r2562423345
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-sagemaker/src/main/java/org/apache/dolphinscheduler/plugin/task/sagemaker/SagemakerTask.java:
##########
@@ -126,26 +126,36 @@ public void submitApplication() throws TaskException {
@Override
public void cancelApplication() {
- initPipelineId();
try {
+ initPipelineId();
// stop pipeline
utils.stopPipelineExecution(client, pipelineId);
} catch (Exception e) {
throw new TaskException("cancel application error", e);
+ } finally {
+ // shutdown client
+ client.shutdown();
}
}
@Override
public void trackApplicationStatus() throws TaskException {
- initPipelineId();
- // Keep checking the health status
- exitStatusCode = utils.checkPipelineExecutionStatus(client,
pipelineId);
+ try {
+ initPipelineId();
+ // Keep checking the health status
+ exitStatusCode = utils.checkPipelineExecutionStatus(client,
pipelineId);
+ } catch (Exception e) {
+ throw new TaskException(e.getMessage(), e);
+ } finally {
+ // shutdown client
+ client.shutdown();
+ }
}
/**
* init sagemaker applicationId if null
*/
- private void initPipelineId() {
+ public void initPipelineId() {
Review Comment:
done
--
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]