use of ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_NOT_FOUND in project comet-java-sdk by comet-ml.
the class BaseExperiment method getArtifactVersionDetail.
/**
* Synchronously retrieves all data about a specific Artifact Version.
*
* @param options the {@link GetArtifactOptions} defining query options.
* @return the {@link LoggedArtifact} instance holding all data about a specific Artifact Version.
* @throws ArtifactNotFoundException if artifact is not found or no artifact data returned.
* @throws InvalidArtifactStateException if artifact was not closed or has empty artifact data returned.
* @throws ArtifactException if failed to get artifact due to the unexpected error.
*/
LoggedArtifact getArtifactVersionDetail(@NonNull GetArtifactOptions options) throws ArtifactNotFoundException, InvalidArtifactStateException, ArtifactException {
try {
ArtifactVersionDetail detail = validateAndGetExperimentKey().concatMap(experimentKey -> getRestApiClient().getArtifactVersionDetail(options, experimentKey)).blockingGet();
ArtifactDto artifactDto = detail.getArtifact();
if (artifactDto == null) {
throw new InvalidArtifactStateException(getString(ARTIFACT_HAS_NO_DETAILS, options));
}
return detail.copyToLoggedArtifact(new LoggedArtifactImpl(artifactDto.getArtifactName(), artifactDto.getArtifactType(), this));
} catch (CometApiException apiException) {
switch(apiException.getSdkErrorCode()) {
case noArtifactFound:
throw new ArtifactNotFoundException(getString(ARTIFACT_NOT_FOUND, options), apiException);
case artifactVersionStateNotClosed:
case artifactVersionStateNotClosedErrorOccurred:
throw new InvalidArtifactStateException(getString(ARTIFACT_NOT_READY, options), apiException);
default:
throw new ArtifactException(getString(GET_ARTIFACT_FAILED_UNEXPECTEDLY, options), apiException);
}
} catch (Throwable e) {
throw new ArtifactException(getString(GET_ARTIFACT_FAILED_UNEXPECTEDLY, options), e);
}
}
Aggregations