niumy0701 commented on code in PR #17718:
URL:
https://github.com/apache/dolphinscheduler/pull/17718#discussion_r2598427283
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsTask.java:
##########
@@ -78,6 +80,42 @@ public void init() throws TaskException {
initDmsHook();
}
+ /**
+ * If appIds is empty, submit a new remote application; otherwise, just
track application status.
+ *
+ * @param taskCallBack
+ * @throws TaskException
+ */
+ @Override
+ public void handle(TaskCallBack taskCallBack) throws TaskException {
+ try {
+ // if appIds is not empty, just track application status, avoid
resubmitting remote task
+ if (StringUtils.isNotEmpty(taskRequest.getAppIds())) {
+ setAppIds(taskRequest.getAppIds());
+ trackApplicationStatus();
+ return;
+ }
+
+ // submit a remote application
+ submitApplication();
+
+ if (StringUtils.isNotEmpty(getAppIds())) {
+ taskRequest.setAppIds(getAppIds());
+ // callback to update remote application info
+
taskCallBack.updateRemoteApplicationInfo(taskRequest.getTaskInstanceId(),
+ new ApplicationInfo(getAppIds()));
+ }
+
+ // keep tracking application status
+ trackApplicationStatus();
Review Comment:
> Yes. We've already safely close connection in `cancelApplication`
Based on the previous discussion with @ruanwenjun , it is necessary to
uniformly close resources in the handle method.
Shall we discuss and confirm again
--
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]