Search in sources :

Example 1 with EMetadataNotFound

use of com.accenture.trac.common.exception.EMetadataNotFound in project tracdap by finos.

the class JobApiService method checkJob.

public CompletionStage<JobStatus> checkJob(JobStatusRequest request) {
    // TODO: Keys for other selector types
    if (!request.getSelector().hasObjectVersion())
        throw new EUnexpected();
    var jobKey = MetadataUtil.objectKey(request.getSelector());
    var jobState = jobCache.readJob(jobKey);
    // TODO: Should there be a different error for jobs not found in the cache? EJobNotLive?
    if (jobState == null) {
        var message = String.format("Job not found (it may have completed): [%s]", jobKey);
        log.error(message);
        throw new EMetadataNotFound(message);
    }
    var jobStatus = reportStatus(jobState);
    return CompletableFuture.completedFuture(jobStatus);
}
Also used : EMetadataNotFound(com.accenture.trac.common.exception.EMetadataNotFound) EUnexpected(com.accenture.trac.common.exception.EUnexpected)

Aggregations

EMetadataNotFound (com.accenture.trac.common.exception.EMetadataNotFound)1 EUnexpected (com.accenture.trac.common.exception.EUnexpected)1