use of com.qlangtech.tis.assemble.FullbuildPhase in project tis by qlangtech.
the class AbstractActionInvocation method createInvocation.
public static ActionInvocation createInvocation(IExecChainContext chainContext, IExecuteInterceptor[] ints) {
final ComponentOrders componentOrders = new ComponentOrders();
AbstractActionInvocation preInvocation = new AbstractActionInvocation();
preInvocation.setContext(chainContext);
preInvocation.setComponentOrders(componentOrders);
AbstractActionInvocation invocation = null;
for (int i = (ints.length - 1); i >= 0; i--) {
for (FullbuildPhase phase : ints[i].getPhase()) {
componentOrders.put(phase, i);
}
invocation = new AbstractActionInvocation();
invocation.setComponentOrders(componentOrders);
invocation.setContext(chainContext);
invocation.setInterceptor(ints[i]);
invocation.setSuccessor(preInvocation);
preInvocation = invocation;
}
logger.info("component description:");
for (Map.Entry<FullbuildPhase, Integer> componentEntry : componentOrders.entrySet()) {
logger.info(componentEntry.getKey() + ":" + componentEntry.getValue());
}
logger.info("description end");
return preInvocation;
}
use of com.qlangtech.tis.assemble.FullbuildPhase in project tis by qlangtech.
the class FullbuildWorkflowAction method doCreateNewTask.
/**
* assemble 节点接收到来自console节点的触发任务,开始执行需要创建一个new的workflowbuildhistory记录
*
* @param context
*/
@Func(value = PermissionConstant.DATAFLOW_MANAGE, sideEffect = false)
public void doCreateNewTask(Context context) {
final TriggerType triggerType = TriggerType.parse(this.getInt(IFullBuildContext.KEY_TRIGGER_TYPE));
Application app = null;
// appname 可以为空
String appname = this.getString(IFullBuildContext.KEY_APP_NAME);
if (StringUtils.isNotBlank(appname)) {
app = this.getApplicationDAO().selectByName(appname);
if (app == null) {
throw new IllegalStateException("appname:" + appname + " relevant app pojo is not exist");
}
}
WorkFlowBuildHistory task = new WorkFlowBuildHistory();
task.setCreateTime(new Date());
task.setStartTime(new Date());
// task.setWorkFlowId(worflowid);
task.setTriggerType(triggerType.getValue());
task.setState((byte) ExecResult.DOING.getValue());
// Integer buildHistoryId = null;
// 从什么阶段开始执行
FullbuildPhase fromPhase = FullbuildPhase.parse(getInt(IParamContext.COMPONENT_START, FullbuildPhase.FullDump.getValue()));
FullbuildPhase endPhase = FullbuildPhase.parse(getInt(IParamContext.COMPONENT_END, FullbuildPhase.IndexBackFlow.getValue()));
if (app == null) {
if (endPhase.bigThan(FullbuildPhase.JOIN)) {
endPhase = FullbuildPhase.JOIN;
}
}
if (fromPhase.getValue() > FullbuildPhase.FullDump.getValue()) {
// 如果是从非第一步开始执行的话,需要客户端提供依赖的history记录id
task.setHistoryId(this.getInt(IFullBuildContext.KEY_BUILD_HISTORY_TASK_ID));
}
// 说明只有workflow的流程和索引没有关系,所以不可能执行到索引build阶段去
// task.setEndPhase((app == null) ? FullbuildPhase.JOIN.getValue() : FullbuildPhase.IndexBackFlow.getValue());
task.setEndPhase(endPhase.getValue());
task.setStartPhase(fromPhase.getValue());
if (app != null) {
task.setAppId(app.getAppId());
task.setAppName(app.getProjectName());
}
// 生成一个新的taskid
this.setBizResult(context, new CreateNewTaskResult(getHistoryDAO().insertSelective(task), app));
}
use of com.qlangtech.tis.assemble.FullbuildPhase in project tis by qlangtech.
the class IndexSwapTaskflowLauncher method loadPhaseStatusFromLocal.
/**
* @param taskid
* @return
* @throws Exception
*/
public static PhaseStatusCollection loadPhaseStatusFromLocal(int taskid) {
PhaseStatusCollection result = null;
FullbuildPhase[] phases = FullbuildPhase.values();
try {
File localFile = null;
BasicPhaseStatus phaseStatus;
for (FullbuildPhase phase : phases) {
localFile = BasicPhaseStatus.getFullBuildPhaseLocalFile(taskid, phase);
if (!localFile.exists()) {
return result;
}
if (result == null) {
result = new PhaseStatusCollection(taskid, ExecutePhaseRange.fullRange());
}
phaseStatus = BasicPhaseStatus.statusWriter.loadPhase(localFile);
switch(phase) {
case FullDump:
result.setDumpPhase((DumpPhaseStatus) phaseStatus);
break;
case JOIN:
result.setJoinPhase((JoinPhaseStatus) phaseStatus);
break;
case BUILD:
result.setBuildPhase((BuildPhaseStatus) phaseStatus);
break;
case IndexBackFlow:
result.setIndexBackFlowPhaseStatus((IndexBackFlowPhaseStatus) phaseStatus);
}
}
} catch (Exception e) {
throw new RuntimeException("taskid:" + taskid, e);
}
return result;
}
Aggregations