Browse Source

[Feature-3773][processInstance, taskInstance] Change title name : Replacement System.currentTimeMillis () (#3774)

* fix bug

Delete invalid field: executorcores

Modify verification prompt

* fix bug

Delete invalid field: executorcores

Modify verification prompt

* fix bug

Delete invalid field: executorcores

Modify verification prompt

* dag  add close button

* reset last version

* reset last version

* dag add close buttion

dag add close buttion

* update  CLICK_SAVE_WORKFLOW_BUTTON  xpath

* updae CLICK_SAVE_WORKFLOW_BUTTON xpath

* updae CLICK_SAVE_WORKFLOW_BUTTON xpath

* updae CLICK_SAVE_WORKFLOW_BUTTON xpath

* Update CreateWorkflowLocator.java

modify submit workflow button

* Update CreateWorkflowLocator.java

* Update CreateWorkflowLocator.java

modify CLICK_ADD_BUTTON

* Update CreateWorkflowLocator.java

delete print

* Update CreateWorkflowLocator.java

1

* Update CreateWorkflowLocator.java

1

* Setting '-XX:+DisableExplicitGC ' causes netty memory leaks

in addition

update '- XX: largepagesizeinbytes = 128M' to '- XX: largepagesizeinbytes = 10M'

* Update dag.vue

* Update dag.vue

* Update dag.vue

* Update CreateWorkflowLocator.java

* Revert "Setting '-XX:+DisableExplicitGC ' causes netty memory leaks"

This reverts commit 3a2cba7a

* Setting '-XX:+DisableExplicitGC ' causes netty memory leaks

in addition

update '- XX: largepagesizeinbytes = 128M' to '- XX: largepagesizeinbytes = 10M'

* Update dolphinscheduler-daemon.sh

* Replacement System.currentTimeMillis () to DateUtils.getCurrentTimeStamp()

* update checkstyle

* update checkstyle

Co-authored-by: dailidong <dailidong66@gmail.com>
Co-authored-by: xingchun-chen <55787491+xingchun-chen@users.noreply.github.com>
pull/3/MERGE
BoYiZhang 4 years ago committed by GitHub
parent
commit
375ec125c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
  2. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
  3. 10
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
  4. 19
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
  5. 198
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java

4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java

@ -845,7 +845,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
try { try {
createProcessResult = createProcessDefinition(loginUser createProcessResult = createProcessDefinition(loginUser
, currentProjectName, , currentProjectName,
processDefinitionName + "_import_" + System.currentTimeMillis(), processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(),
importProcessParam, importProcessParam,
processMeta.getProcessDefinitionDescription(), processMeta.getProcessDefinitionDescription(),
processMeta.getProcessDefinitionLocations(), processMeta.getProcessDefinitionLocations(),
@ -1433,7 +1433,7 @@ public class ProcessDefinitionServiceImpl extends BaseService implements
return createProcessDefinition( return createProcessDefinition(
loginUser, loginUser,
targetProject.getName(), targetProject.getName(),
processDefinition.getName() + "_copy_" + System.currentTimeMillis(), processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(),
processDefinition.getProcessDefinitionJson(), processDefinition.getProcessDefinitionJson(),
processDefinition.getDescription(), processDefinition.getDescription(),
processDefinition.getLocations(), processDefinition.getLocations(),

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java

@ -266,6 +266,10 @@ public final class Constants {
*/ */
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
/**
* date format of yyyyMMddHHmmssSSS
*/
public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS";
/** /**
* http connect time out * http connect time out
*/ */

10
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java

@ -444,4 +444,14 @@ public class DateUtils {
long usedTime = (System.currentTimeMillis() - baseTime.getTime()) / 1000; long usedTime = (System.currentTimeMillis() - baseTime.getTime()) / 1000;
return intervalSeconds - usedTime; return intervalSeconds - usedTime;
} }
/**
* get current time stamp : yyyyMMddHHmmssSSS
*
* @return date string
*/
public static String getCurrentTimeStamp() {
return getCurrentTime(Constants.YYYYMMDDHHMMSSSSS);
}
} }

19
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java

@ -14,14 +14,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.common.utils; package org.apache.dolphinscheduler.common.utils;
import org.junit.Assert;
import org.junit.Test;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
public class DateUtilsTest { public class DateUtilsTest {
@Test @Test
public void format2Readable() throws ParseException { public void format2Readable() throws ParseException {
@ -38,10 +40,8 @@ public class DateUtilsTest {
Assert.assertEquals("01 09:23:08", readableDate); Assert.assertEquals("01 09:23:08", readableDate);
} }
@Test @Test
public void testWeek(){ public void testWeek() {
Date curr = DateUtils.stringToDate("2019-02-01 00:00:00"); Date curr = DateUtils.stringToDate("2019-02-01 00:00:00");
Date monday1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date monday1 = DateUtils.stringToDate("2019-01-28 00:00:00");
Date sunday1 = DateUtils.stringToDate("2019-02-03 00:00:00"); Date sunday1 = DateUtils.stringToDate("2019-02-03 00:00:00");
@ -54,7 +54,7 @@ public class DateUtilsTest {
} }
@Test @Test
public void diffHours(){ public void diffHours() {
Date d1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date d1 = DateUtils.stringToDate("2019-01-28 00:00:00");
Date d2 = DateUtils.stringToDate("2019-01-28 20:00:00"); Date d2 = DateUtils.stringToDate("2019-01-28 20:00:00");
Assert.assertEquals(DateUtils.diffHours(d1, d2), 20); Assert.assertEquals(DateUtils.diffHours(d1, d2), 20);
@ -150,4 +150,11 @@ public class DateUtilsTest {
Date curr = DateUtils.getEndOfHour(d1); Date curr = DateUtils.getEndOfHour(d1);
Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59");
} }
@Test
public void getCurrentTimeStamp() {
String timeStamp = DateUtils.getCurrentTimeStamp();
Assert.assertNotNull(timeStamp);
}
} }

198
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java

@ -14,18 +14,27 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.dao.entity; package org.apache.dolphinscheduler.dao.entity;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import java.util.Date;
import java.util.Objects;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.dolphinscheduler.common.enums.*;
import java.util.Date;
import java.util.Objects;
/** /**
* process instance * process instance
@ -36,7 +45,7 @@ public class ProcessInstance {
/** /**
* id * id
*/ */
@TableId(value="id", type=IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private int id; private int id;
/** /**
* process definition id * process definition id
@ -53,13 +62,13 @@ public class ProcessInstance {
/** /**
* start time * start time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
/** /**
* end time * end time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime; private Date endTime;
/** /**
@ -120,13 +129,13 @@ public class ProcessInstance {
/** /**
* schedule time * schedule time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date scheduleTime; private Date scheduleTime;
/** /**
* command start time * command start time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date commandStartTime; private Date commandStartTime;
/** /**
@ -189,6 +198,7 @@ public class ProcessInstance {
/** /**
* process duration * process duration
*
* @return * @return
*/ */
@TableField(exist = false) @TableField(exist = false)
@ -226,19 +236,24 @@ public class ProcessInstance {
@TableField(exist = false) @TableField(exist = false)
private String receiversCc; private String receiversCc;
public ProcessInstance(){ public ProcessInstance() {
} }
/** /**
* set the process name with process define version and timestamp * set the process name with process define version and timestamp
*
* @param processDefinition processDefinition * @param processDefinition processDefinition
*/ */
public ProcessInstance(ProcessDefinition processDefinition){ public ProcessInstance(ProcessDefinition processDefinition) {
this.processDefinition = processDefinition; this.processDefinition = processDefinition;
this.name = processDefinition.getName() + "-" + this.name = processDefinition.getName()
processDefinition.getVersion() + "-" + + "-"
System.currentTimeMillis(); +
processDefinition.getVersion()
+ "-"
+
DateUtils.getCurrentTimeStamp();
} }
public ProcessDefinition getProcessDefinition() { public ProcessDefinition getProcessDefinition() {
@ -313,7 +328,6 @@ public class ProcessInstance {
this.name = name; this.name = name;
} }
public String getHost() { public String getHost() {
return host; return host;
} }
@ -322,7 +336,6 @@ public class ProcessInstance {
this.host = host; this.host = host;
} }
public CommandType getCommandType() { public CommandType getCommandType() {
return commandType; return commandType;
} }
@ -347,7 +360,6 @@ public class ProcessInstance {
this.taskDependType = taskDependType; this.taskDependType = taskDependType;
} }
public int getMaxTryTimes() { public int getMaxTryTimes() {
return maxTryTimes; return maxTryTimes;
} }
@ -364,8 +376,7 @@ public class ProcessInstance {
this.failureStrategy = failureStrategy; this.failureStrategy = failureStrategy;
} }
public boolean isProcessInstanceStop() {
public boolean isProcessInstanceStop(){
return this.state.typeIsFinished(); return this.state.typeIsFinished();
} }
@ -441,7 +452,6 @@ public class ProcessInstance {
this.executorId = executorId; this.executorId = executorId;
} }
public Flag getIsSubProcess() { public Flag getIsSubProcess() {
return isSubProcess; return isSubProcess;
} }
@ -457,6 +467,7 @@ public class ProcessInstance {
public void setProcessInstancePriority(Priority processInstancePriority) { public void setProcessInstancePriority(Priority processInstancePriority) {
this.processInstancePriority = processInstancePriority; this.processInstancePriority = processInstancePriority;
} }
public String getLocations() { public String getLocations() {
return locations; return locations;
} }
@ -477,6 +488,10 @@ public class ProcessInstance {
return historyCmd; return historyCmd;
} }
public void setHistoryCmd(String historyCmd) {
this.historyCmd = historyCmd;
}
public String getExecutorName() { public String getExecutorName() {
return executorName; return executorName;
} }
@ -485,28 +500,26 @@ public class ProcessInstance {
this.executorName = executorName; this.executorName = executorName;
} }
public void setHistoryCmd(String historyCmd) {
this.historyCmd = historyCmd;
}
/** /**
* add command to history * add command to history
*
* @param cmd cmd * @param cmd cmd
*/ */
public void addHistoryCmd(CommandType cmd){ public void addHistoryCmd(CommandType cmd) {
if(StringUtils.isNotEmpty(this.historyCmd)){ if (StringUtils.isNotEmpty(this.historyCmd)) {
this.historyCmd = String.format("%s,%s", this.historyCmd, cmd.toString()); this.historyCmd = String.format("%s,%s", this.historyCmd, cmd.toString());
}else{ } else {
this.historyCmd = cmd.toString(); this.historyCmd = cmd.toString();
} }
} }
/** /**
* check this process is start complement data * check this process is start complement data
*
* @return whether complement data * @return whether complement data
*/ */
public boolean isComplementData(){ public boolean isComplementData() {
if(StringUtils.isEmpty(this.historyCmd)){ if (StringUtils.isEmpty(this.historyCmd)) {
return false; return false;
} }
return historyCmd.startsWith(CommandType.COMPLEMENT_DATA.toString()); return historyCmd.startsWith(CommandType.COMPLEMENT_DATA.toString());
@ -515,10 +528,11 @@ public class ProcessInstance {
/** /**
* get current command type, * get current command type,
* if start with complement data,return complement * if start with complement data,return complement
*
* @return CommandType * @return CommandType
*/ */
public CommandType getCmdTypeIfComplement(){ public CommandType getCmdTypeIfComplement() {
if(isComplementData()){ if (isComplementData()) {
return CommandType.COMPLEMENT_DATA; return CommandType.COMPLEMENT_DATA;
} }
return commandType; return commandType;
@ -556,15 +570,14 @@ public class ProcessInstance {
this.timeout = timeout; this.timeout = timeout;
} }
public int getTenantId() {
return this.tenantId;
}
public void setTenantId(int tenantId) { public void setTenantId(int tenantId) {
this.tenantId = tenantId; this.tenantId = tenantId;
} }
public int getTenantId() {
return this.tenantId ;
}
public String getReceivers() { public String getReceivers() {
return receivers; return receivers;
} }
@ -583,44 +596,83 @@ public class ProcessInstance {
@Override @Override
public String toString() { public String toString() {
return "ProcessInstance{" + return "ProcessInstance{"
"id=" + id + + "id=" + id
", processDefinitionId=" + processDefinitionId + + ", processDefinitionId=" + processDefinitionId
", state=" + state + + ", state=" + state
", recovery=" + recovery + + ", recovery=" + recovery
", startTime=" + startTime + + ", startTime=" + startTime
", endTime=" + endTime + + ", endTime=" + endTime
", runTimes=" + runTimes + + ", runTimes=" + runTimes
", name='" + name + '\'' + + ", name='" + name + '\''
", host='" + host + '\'' + + ", host='" + host + '\''
", processDefinition=" + processDefinition + + ", processDefinition="
", commandType=" + commandType + + processDefinition
", commandParam='" + commandParam + '\'' + + ", commandType="
", taskDependType=" + taskDependType + + commandType
", maxTryTimes=" + maxTryTimes + + ", commandParam='"
", failureStrategy=" + failureStrategy + + commandParam
", warningType=" + warningType + + '\''
", warningGroupId=" + warningGroupId + + ", taskDependType="
", scheduleTime=" + scheduleTime + + taskDependType
", commandStartTime=" + commandStartTime + + ", maxTryTimes="
", globalParams='" + globalParams + '\'' + + maxTryTimes
", processInstanceJson='" + processInstanceJson + '\'' + + ", failureStrategy="
", executorId=" + executorId + + failureStrategy
", tenantCode='" + tenantCode + '\'' + + ", warningType="
", queue='" + queue + '\'' + + warningType
", isSubProcess=" + isSubProcess + + ", warningGroupId="
", locations='" + locations + '\'' + + warningGroupId
", connects='" + connects + '\'' + + ", scheduleTime="
", historyCmd='" + historyCmd + '\'' + + scheduleTime
", dependenceScheduleTimes='" + dependenceScheduleTimes + '\'' + + ", commandStartTime="
", duration=" + duration + + commandStartTime
", processInstancePriority=" + processInstancePriority + + ", globalParams='"
", workerGroup='" + workerGroup + '\'' + + globalParams
", timeout=" + timeout + + '\''
", tenantId=" + tenantId + + ", processInstanceJson='"
", receivers='" + receivers + '\'' + + processInstanceJson
", receiversCc='" + receiversCc + '\'' + + '\''
'}'; + ", executorId="
+ executorId
+ ", tenantCode='"
+ tenantCode
+ '\''
+ ", queue='"
+ queue
+ '\''
+ ", isSubProcess="
+ isSubProcess
+ ", locations='"
+ locations
+ '\''
+ ", connects='"
+ connects
+ '\''
+ ", historyCmd='"
+ historyCmd
+ '\''
+ ", dependenceScheduleTimes='"
+ dependenceScheduleTimes
+ '\''
+ ", duration="
+ duration
+ ", processInstancePriority="
+ processInstancePriority
+ ", workerGroup='"
+ workerGroup
+ '\''
+ ", timeout="
+ timeout
+ ", tenantId="
+ tenantId
+ ", receivers='"
+ receivers
+ '\''
+ ", receiversCc='"
+ receiversCc
+ '\''
+ '}';
} }
@Override @Override

Loading…
Cancel
Save