zixi0825 commented on code in PR #16863:
URL: 
https://github.com/apache/dolphinscheduler/pull/16863#discussion_r3791730933


##########
dolphinscheduler-api/src/main/resources/task-type-config.yaml:
##########
@@ -47,12 +47,15 @@ task:
     - 'SEATUNNEL'
     - 'DATAX'
     - 'SQOOP'
+  dataQuality:
+    - 'DATAVINES'
   machineLearning:
     - 'JUPYTER'
     - 'MLFLOW'
     - 'OPENMLDB'
     - 'DVC'
     - 'SAGEMAKER'
+    - 'PYTORCH'

Review Comment:
   Thanks. `PYTORCH` has been removed from `task-type-config.yaml`; only 
`DATAVINES` is added by this PR (commit 9b02337514).



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-datavines/src/test/java/org/apache/dolphinscheduler/plugin/task/datavines/DatavinesTaskTest.java:
##########
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.plugin.task.datavines;
+
+import static 
org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
+import static 
org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_SUCCESS;
+import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

Review Comment:
   Thanks. The test now uses `org.junit.jupiter.api.Assertions` only (commit 
9b02337514).



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-datavines/src/main/java/org/apache/dolphinscheduler/plugin/task/datavines/DatavinesTask.java:
##########
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.plugin.task.datavines;
+
+import static 
org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
+import static 
org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_SUCCESS;
+
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.plugin.task.api.AbstractRemoteTask;
+import org.apache.dolphinscheduler.plugin.task.api.TaskException;
+import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
+import 
org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
+import org.apache.dolphinscheduler.plugin.task.datavines.utils.RequestUtils;
+
+import java.util.Collections;
+import java.util.List;
+
+import lombok.extern.slf4j.Slf4j;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.MissingNode;
+import com.fasterxml.jackson.databind.node.NullNode;
+
+@Slf4j
+public class DatavinesTask extends AbstractRemoteTask {
+
+    private final TaskExecutionContext taskExecutionContext;
+
+    private DatavinesParameters datavinesParameters;
+    private String jobExecutionId;
+    private boolean executionStatus;
+
+    protected DatavinesTask(TaskExecutionContext taskExecutionContext) {
+        super(taskExecutionContext);
+        this.taskExecutionContext = taskExecutionContext;
+    }
+
+    @Override
+    public List<String> getApplicationIds() throws TaskException {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public void init() {
+        final String taskParams = taskExecutionContext.getTaskParams();
+        this.datavinesParameters = JSONUtils.parseObject(taskParams, 
DatavinesParameters.class);
+        log.info("initialize datavines task params : {}", 
JSONUtils.toPrettyJsonString(datavinesParameters));
+        if (this.datavinesParameters == null || 
!this.datavinesParameters.checkParameters()) {
+            throw new DatavinesTaskException("datavines task params is not 
valid");
+        }
+    }
+
+    @Override
+    public void submitApplication() throws TaskException {
+        executeJob();
+    }
+
+    @Override
+    public void trackApplicationStatus() throws TaskException {
+        trackApplicationStatusInner();
+    }
+
+    private void executeJob() {
+        try {
+            String address = this.datavinesParameters.getAddress();
+            String jobId = this.datavinesParameters.getJobId();
+            String token = this.datavinesParameters.getToken();
+            String apiResultDataKey = DatavinesTaskConstants.API_RESULT_DATA;
+            JsonNode result = RequestUtils.executeJob(address, jobId, token);
+            if (checkResult(result)) {
+                jobExecutionId = result.get(apiResultDataKey).asText();
+                executionStatus = true;
+            }
+        } catch (Exception ex) {
+            Thread.currentThread().interrupt();
+            log.error(DatavinesTaskConstants.SUBMIT_FAILED_MSG, ex);
+            setExitStatusCode(EXIT_CODE_FAILURE);
+            throw new TaskException(DatavinesTaskConstants.SUBMIT_FAILED_MSG, 
ex);
+        }
+    }
+
+    public void trackApplicationStatusInner() throws TaskException {
+        try {
+            String address = this.datavinesParameters.getAddress();
+            if (executionStatus && jobExecutionId == null) {
+                // Use address-taskId as app id
+                setAppIds(String.format(DatavinesTaskConstants.APPIDS_FORMAT, 
address, this.jobExecutionId));

Review Comment:
   Thanks. The early-failure branch now uses the configured `jobId` for the app 
id instead of the null `jobExecutionId` (commit 4cb4274b0e).



-- 
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]

Reply via email to