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