Search in sources :

Example 1 with PipelineResponseException

use of com.epam.pipeline.exception.PipelineResponseException in project cloud-pipeline by epam.

the class PipelineRunMapperOld method getRequestForRun.

private Optional<DocWriteRequest> getRequestForRun(final String indexName, final PipelineEvent event, final Map<String, PipelineUser> users) {
    try {
        PipelineRunWithLog run = cloudPipelineAPIClient.loadPipelineRunWithLogs(event.getObjectId());
        PipelineUser pipelineUser = users.get(run.getPipelineRun().getOwner());
        run.setRunOwner(pipelineUser);
        return Optional.of(new IndexRequest(indexName, INDEX_TYPE, String.valueOf(run.getPipelineRun().getId())).source(pipelineRunToDocument(run)));
    } catch (PipelineResponseException e) {
        log.error(e.getMessage(), e);
        if (isRunMissingError(event, e)) {
            return Optional.of(createDeleteRequest(event, indexName));
        }
        return Optional.empty();
    }
}
Also used : PipelineUser(com.epam.pipeline.entity.user.PipelineUser) PipelineResponseException(com.epam.pipeline.exception.PipelineResponseException) PipelineRunWithLog(com.epam.pipeline.elasticsearchagent.model.PipelineRunWithLog) IndexRequest(org.elasticsearch.action.index.IndexRequest)

Aggregations

PipelineRunWithLog (com.epam.pipeline.elasticsearchagent.model.PipelineRunWithLog)1 PipelineUser (com.epam.pipeline.entity.user.PipelineUser)1 PipelineResponseException (com.epam.pipeline.exception.PipelineResponseException)1 IndexRequest (org.elasticsearch.action.index.IndexRequest)1