Search in sources :

Example 1 with PipelineExecutorTaskDefImpl

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);
}
Also used : PipelineExecutorTaskDefImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl) BusinessException(org.guvnor.ala.services.exceptions.BusinessException) ProviderType(org.guvnor.ala.runtime.providers.ProviderType) ConfigBasedPipeline(org.guvnor.ala.pipeline.ConfigBasedPipeline) Pipeline(org.guvnor.ala.pipeline.Pipeline) Provider(org.guvnor.ala.runtime.providers.Provider) PipelineExecutorTaskDef(org.guvnor.ala.pipeline.execution.PipelineExecutorTaskDef)

Example 2 with PipelineExecutorTaskDefImpl

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);
}
Also used : PipelineExecutorTaskDefImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl) Input(org.guvnor.ala.pipeline.Input) PipelineExecutorTaskImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskImpl) PipelineExecutorTraceImpl(org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTraceImpl) Stage(org.guvnor.ala.pipeline.Stage) BasePipeline(org.guvnor.ala.pipeline.impl.BasePipeline) BasePipeline(org.guvnor.ala.pipeline.impl.BasePipeline) Pipeline(org.guvnor.ala.pipeline.Pipeline)

Aggregations

Pipeline (org.guvnor.ala.pipeline.Pipeline)2 PipelineExecutorTaskDefImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskDefImpl)2 ConfigBasedPipeline (org.guvnor.ala.pipeline.ConfigBasedPipeline)1 Input (org.guvnor.ala.pipeline.Input)1 Stage (org.guvnor.ala.pipeline.Stage)1 PipelineExecutorTaskDef (org.guvnor.ala.pipeline.execution.PipelineExecutorTaskDef)1 PipelineExecutorTaskImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTaskImpl)1 PipelineExecutorTraceImpl (org.guvnor.ala.pipeline.execution.impl.PipelineExecutorTraceImpl)1 BasePipeline (org.guvnor.ala.pipeline.impl.BasePipeline)1 Provider (org.guvnor.ala.runtime.providers.Provider)1 ProviderType (org.guvnor.ala.runtime.providers.ProviderType)1 BusinessException (org.guvnor.ala.services.exceptions.BusinessException)1