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/09/19 02:50:39 UTC

[GitHub] [incubator-dolphinscheduler] yangyichao-mango commented on a change in pull request #3733: [Feature-3633][server,common] Let dependent nodes wait for a while before the pre-dependency starts

yangyichao-mango commented on a change in pull request #3733:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/3733#discussion_r491259756



##########
File path: dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/model/TaskNode.java
##########
@@ -296,18 +304,49 @@ public void setTimeout(String timeout) {
     this.timeout = timeout;
   }
 
-  /**
-   * get task time out parameter
-   * @return task time out parameter
-   */
-  public TaskTimeoutParameter getTaskTimeoutParameter() {
-    if(StringUtils.isNotEmpty(this.getTimeout())){
-      String formatStr = String.format("%s,%s", TaskTimeoutStrategy.WARN.name(), TaskTimeoutStrategy.FAILED.name());
-      String taskTimeout = this.getTimeout().replace(formatStr,TaskTimeoutStrategy.WARNFAILED.name());
-      return JSONUtils.parseObject(taskTimeout,TaskTimeoutParameter.class);
+    public String getWaitStartTimeout() {
+        return waitStartTimeout;
+    }
+
+    public void setWaitStartTimeout(String waitStartTimeout) {
+        this.waitStartTimeout = waitStartTimeout;
+    }
+
+    /**
+     * get task time out parameter
+     *
+     * @return task time out parameter
+     */
+    public TaskTimeoutParameter getTaskTimeoutParameter() {
+        return parseTimeoutParameter(this.timeout);
+    }
+
+    /**
+     * get task timeout parameter for dependent node
+     *
+     * @return timeout parameter
+     */
+    public TaskTimeoutParameter getTaskTimeoutParameterForDependentNode() {
+        return parseTimeoutParameter(this.waitStartTimeout);
+    }
+
+    /**
+     * parse string to timeout parameter instance
+     * @param timeoutParameterString timeout description string
+     * @return TaskTimeoutParameter
+     */
+    private TaskTimeoutParameter parseTimeoutParameter(String timeoutParameterString) {
+        TaskTimeoutParameter taskTimeoutParameter = null;

Review comment:
       Will it better to make the `parseTimeoutParameter` static method?
   Because this method make a new instance inner.




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