use of com.alibaba.otter.shared.common.model.config.enums.StageType in project otter by alibaba.
the class OtterController method startPipeline.
// ===================== helper method ======================
public void startPipeline(NodeTask nodeTask) {
Long pipelineId = nodeTask.getPipeline().getId();
releasePipeline(pipelineId);
Map<StageType, GlobalTask> tasks = controllers.get(pipelineId);
// 处理具体的任务命令
List<StageType> stage = nodeTask.getStage();
List<TaskEvent> event = nodeTask.getEvent();
for (int i = 0; i < stage.size(); i++) {
StageType stageType = stage.get(i);
TaskEvent taskEvent = event.get(i);
if (taskEvent.isCreate()) {
startTask(nodeTask.getPipeline(), tasks, stageType);
} else {
stopTask(tasks, stageType);
}
}
}
use of com.alibaba.otter.shared.common.model.config.enums.StageType in project otter by alibaba.
the class OtterController method process.
public boolean process(List<NodeTask> nodeTasks) {
if (nodeTasks == null || nodeTasks.isEmpty()) {
return true;
}
for (NodeTask nodeTask : nodeTasks) {
boolean shutdown = nodeTask.isShutdown();
Long pipelineId = nodeTask.getPipeline().getId();
if (shutdown) {
Map<StageType, GlobalTask> tasks = controllers.remove(pipelineId);
if (tasks != null) {
logger.info("INFO ## shutdown this pipeline sync ,the pipelineId = {} and tasks = {}", pipelineId, tasks.keySet());
stopPipeline(pipelineId, tasks);
} else {
logger.info("INFO ## this pipeline id = {} is not start sync", pipelineId);
}
} else {
startPipeline(nodeTask);
}
}
return true;
}
Aggregations