CalvinKirs commented on a change in pull request #6015:
URL: https://github.com/apache/dolphinscheduler/pull/6015#discussion_r696231720



##########
File path: 
dolphinscheduler-task-plugin/dolphinscheduler-task-tis/src/main/java/org/apache/dolphinscheduler/plugin/task/tis/TISTask.java
##########
@@ -0,0 +1,345 @@
+/*
+ * 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.tis;
+
+import org.apache.dolphinscheduler.common.utils.CollectionUtils;
+import org.apache.dolphinscheduler.spi.task.AbstractParameters;
+import org.apache.dolphinscheduler.spi.task.AbstractTask;
+import org.apache.dolphinscheduler.spi.task.TaskConstants;
+import org.apache.dolphinscheduler.spi.task.TaskRequest;
+import org.apache.dolphinscheduler.spi.utils.JSONUtils;
+import org.apache.dolphinscheduler.spi.utils.StringUtils;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.StatusLine;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.net.HttpURLConnection;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import org.asynchttpclient.Dsl;
+import org.asynchttpclient.ws.WebSocket;
+import org.asynchttpclient.ws.WebSocketListener;
+import org.asynchttpclient.ws.WebSocketUpgradeHandler;
+import org.slf4j.Logger;
+
+/**
+ * TIS DataX Task
+ **/
+public class TISTask extends AbstractTask {
+
+    public static final String WS_REQUEST_PATH = "/tjs/download/logfeedback";
+    public static final String KEY_POOL_VAR_TIS_HOST = "tisHost";
+    private final TaskRequest taskExecutionContext;
+
+    private TISParameters tisParameters;
+
+    public TISTask(TaskRequest taskExecutionContext, Logger logger) {
+        super(taskExecutionContext, logger);
+        this.taskExecutionContext = taskExecutionContext;
+    }
+
+    @Override
+    public void init() {
+        super.init();
+        logger.info("tis task params {}", 
taskExecutionContext.getTaskParams());
+        tisParameters = 
JSONUtils.parseObject(taskExecutionContext.getTaskParams(), 
TISParameters.class);
+        if (!tisParameters.checkParameters()) {
+            throw new RuntimeException("datax task params is not valid");
+        }
+    }
+
+    @Override
+    public void handle() throws Exception {
+        // Trigger TIS DataX pipeline
+        logger.info("start execute TIS task");
+        long startTime = System.currentTimeMillis();
+        String targetJobName = this.tisParameters.getTargetJobName();
+        final String tisHost = 
taskExecutionContext.getDefinedParams().get(KEY_POOL_VAR_TIS_HOST);
+        if (StringUtils.isEmpty(tisHost)) {
+            throw new IllegalStateException("global var '" + 
KEY_POOL_VAR_TIS_HOST + "' can not be empty");
+        }
+        try {
+            final String triggerUrl = 
String.format("http://%s/tjs/coredefine/coredefine.ajax";, tisHost);
+            final String getStatusUrl = 
String.format("http://%s/tjs/config/config.ajax?action=collection_action&emethod=get_task_status";,
 tisHost);
+            HttpPost post = new HttpPost(triggerUrl);

Review comment:
       hi, it seems that the parameter substitution step is missing.




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