Search in sources :

Example 1 with StageInfo

use of pipelite.controller.api.info.StageInfo in project pipelite by enasequence.

the class StageController method stages.

@GetMapping("/{pipelineName}/{processId}")
@ResponseStatus(HttpStatus.OK)
@Operation(description = "Process stages")
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "500", description = "Internal Server error") })
public List<StageInfo> stages(@PathVariable(value = "pipelineName") String pipelineName, @PathVariable(value = "processId") String processId) {
    List<StageInfo> list = new ArrayList<>();
    AtomicReference<Process> process = new AtomicReference<>();
    try {
        RegisteredPipeline registeredPipeline = registeredPipelineService.getRegisteredPipeline(pipelineName);
        ProcessBuilder processBuilder = new ProcessBuilder(processId);
        registeredPipeline.configureProcess(processBuilder);
        process.set(processBuilder.build());
    } catch (Exception ex) {
        log.atSevere().withCause(ex).log(ex.getMessage());
    }
    stageService.getSavedStages(pipelineName, processId).forEach(stageEntity -> list.add(getStage(stageEntity, process.get())));
    return list;
}
Also used : StageInfo(pipelite.controller.api.info.StageInfo) ProcessBuilder(pipelite.process.builder.ProcessBuilder) ArrayList(java.util.ArrayList) Process(pipelite.process.Process) AtomicReference(java.util.concurrent.atomic.AtomicReference) RegisteredPipeline(pipelite.RegisteredPipeline) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)1 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)1 ArrayList (java.util.ArrayList)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 RegisteredPipeline (pipelite.RegisteredPipeline)1 StageInfo (pipelite.controller.api.info.StageInfo)1 Process (pipelite.process.Process)1 ProcessBuilder (pipelite.process.builder.ProcessBuilder)1