use of org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl in project kie-wb-common by kiegroup.
the class RestPipelineServiceImpl method runPipeline.
@Override
public String runPipeline(final String pipelineId, final Input input, final boolean async) throws BusinessException {
final Pipeline pipeline = pipelineRegistry.getPipelineByName(pipelineId);
if (pipeline == null) {
throw new BusinessException("Pipeline: " + pipelineId + " was not found.");
}
String providerName = input.get(ProviderConfig.PROVIDER_NAME);
Provider provider = null;
ProviderType providerType = null;
PipelineExecutorTaskDef taskDef;
if (providerName != null && !providerName.isEmpty()) {
provider = runtimeRegistry.getProvider(providerName);
}
if (provider == null) {
providerType = pipelineRegistry.getProviderType(pipelineId);
}
if (provider != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, provider);
} else if (providerType != null) {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input, providerType);
} else {
taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
}
return executorTaskManager.execute(taskDef, async ? PipelineExecutorTaskManager.ExecutionMode.ASYNCHRONOUS : PipelineExecutorTaskManager.ExecutionMode.SYNCHRONOUS);
}
use of org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl in project kie-wb-common by kiegroup.
the class PipelineExecutorTraceImplMarshallerTest method getValue.
@Override
public PipelineExecutorTraceImpl getValue() {
// only the stage names are used by the taskDef, so the pipeline can be mocked.
List<Stage> stages = mockStages(STAGE_COUNT);
Pipeline pipeline = new BasePipeline(PIPELINE_NAME, stages) {
};
Input input = mockInput(PIPELINE_INPUT_SIZE);
PipelineExecutorTaskDefImpl taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
PipelineExecutorTaskImpl taskImpl = new PipelineExecutorTaskImpl(taskDef, PIPELINE_EXECUTION_ID);
taskImpl.setPipelineStatus(PipelineExecutorTask.Status.SCHEDULED);
taskImpl.setPipelineError(mockError(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL));
taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage)));
taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT));
return new PipelineExecutorTraceImpl(taskImpl);
}
Aggregations