niumy0701 commented on code in PR #17719:
URL:
https://github.com/apache/dolphinscheduler/pull/17719#discussion_r2591249226
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-emr/src/main/java/org/apache/dolphinscheduler/plugin/task/emr/EmrJobFlowTask.java:
##########
@@ -180,11 +180,23 @@ private ClusterStatus getClusterStatus() {
@Override
public void cancelApplication() throws TaskException {
- log.info("trying terminate job flow, taskId:{}, clusterId:{}",
this.taskExecutionContext.getTaskInstanceId(),
- clusterId);
- TerminateJobFlowsRequest terminateJobFlowsRequest = new
TerminateJobFlowsRequest().withJobFlowIds(clusterId);
- TerminateJobFlowsResult terminateJobFlowsResult =
emrClient.terminateJobFlows(terminateJobFlowsRequest);
- log.info("the result of terminate job flow is:{}",
terminateJobFlowsResult);
+ try {
+ log.info("trying terminate job flow, taskId:{}, clusterId:{}",
+ this.taskExecutionContext.getTaskInstanceId(),
+ clusterId);
+ TerminateJobFlowsRequest terminateJobFlowsRequest =
+ new TerminateJobFlowsRequest().withJobFlowIds(clusterId);
+ TerminateJobFlowsResult terminateJobFlowsResult =
emrClient.terminateJobFlows(terminateJobFlowsRequest);
+ log.info("the result of terminate job flow is:{}",
terminateJobFlowsResult);
+ } catch (Exception e) {
+ log.error("emr job flow task cancel error: {}", e.getMessage(), e);
+ throw new TaskException("emr job flow task cancel error: " +
e.getMessage(), e);
+ } finally {
+ // shutdown emrclient
+ if (emrClient != null) {
+ emrClient.shutdown();
+ }
+ }
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]