You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/12/14 02:22:00 UTC

[GitHub] [incubator-dolphinscheduler] lenboo commented on a change in pull request #4216: [FIX-#3177]Task time parameter parsing error

lenboo commented on a change in pull request #4216:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/4216#discussion_r542068596



##########
File path: dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/shell/ShellTask.java
##########
@@ -43,136 +42,137 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.slf4j.Logger;
+
 /**
  * shell task
  */
 public class ShellTask extends AbstractTask {
 
-  /**
-   * shell parameters
-   */
-  private ShellParameters shellParameters;
-
-  /**
-   * shell command executor
-   */
-  private ShellCommandExecutor shellCommandExecutor;
-
-  /**
-   *  taskExecutionContext
-   */
-  private TaskExecutionContext taskExecutionContext;
-
-  /**
-   * constructor
-   * @param taskExecutionContext taskExecutionContext
-   * @param logger    logger
-   */
-  public ShellTask(TaskExecutionContext taskExecutionContext, Logger logger) {
-    super(taskExecutionContext, logger);
-
-    this.taskExecutionContext = taskExecutionContext;
-    this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
+    /**
+     * shell parameters
+     */
+    private ShellParameters shellParameters;
+
+    /**
+     * shell command executor
+     */
+    private ShellCommandExecutor shellCommandExecutor;
+
+    /**
+     * taskExecutionContext
+     */
+    private TaskExecutionContext taskExecutionContext;
+
+    /**
+     * constructor
+     *
+     * @param taskExecutionContext taskExecutionContext
+     * @param logger               logger
+     */
+    public ShellTask(TaskExecutionContext taskExecutionContext, Logger logger) {
+        super(taskExecutionContext, logger);
+
+        this.taskExecutionContext = taskExecutionContext;
+        this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
             taskExecutionContext,
             logger);
-  }
+    }
 
-  @Override
-  public void init() {
-    logger.info("shell task params {}", taskExecutionContext.getTaskParams());
+    @Override
+    public void init() {
+        logger.info("shell task params {}", taskExecutionContext.getTaskParams());
 
-    shellParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), ShellParameters.class);
+        shellParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), ShellParameters.class);
 
-    if (!shellParameters.checkParameters()) {
-      throw new RuntimeException("shell task params is not valid");
-    }
-  }
-
-  @Override
-  public void handle() throws Exception {
-    try {
-      // construct process
-      CommandExecuteResult commandExecuteResult = shellCommandExecutor.run(buildCommand());
-      setExitStatusCode(commandExecuteResult.getExitStatusCode());
-      setAppIds(commandExecuteResult.getAppIds());
-      setProcessId(commandExecuteResult.getProcessId());
-    } catch (Exception e) {
-      logger.error("shell task error", e);
-      setExitStatusCode(Constants.EXIT_CODE_FAILURE);
-      throw e;
+        if (!shellParameters.checkParameters()) {
+            throw new RuntimeException("shell task params is not valid");
+        }

Review comment:
       it's all right.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org