Search in sources :

Example 1 with Artifact

use of ml.comet.experiment.artifact.Artifact in project comet-java-sdk by comet-ml.

the class BaseExperiment method upsertArtifact.

/**
 * Synchronously upsert provided Comet artifact into Comet backend.
 *
 * @param artifact the {@link ArtifactImpl} instance.
 * @return the {@link ArtifactEntry} describing saved artifact.
 * @throws ArtifactException if operation failed.
 */
ArtifactEntry upsertArtifact(@NonNull final Artifact artifact) throws ArtifactException {
    try {
        ArtifactImpl artifactImpl = (ArtifactImpl) artifact;
        ArtifactRequest request = createArtifactUpsertRequest(artifactImpl);
        ArtifactEntry response = validateAndGetExperimentKey().concatMap(experimentKey -> getRestApiClient().upsertArtifact(request, experimentKey)).blockingGet();
        if (StringUtils.isBlank(response.getPreviousVersion())) {
            getLogger().info(getString(ARTIFACT_VERSION_CREATED_WITHOUT_PREVIOUS, artifactImpl.getName(), response.getCurrentVersion()));
        } else {
            getLogger().info(getString(ARTIFACT_VERSION_CREATED_WITH_PREVIOUS, artifactImpl.getName(), response.getCurrentVersion(), response.getPreviousVersion()));
        }
        return response;
    } catch (Throwable e) {
        throw new ArtifactException(getString(FAILED_TO_UPSERT_ARTIFACT, artifact), e);
    }
}
Also used : Connection(ml.comet.experiment.impl.http.Connection) RestApiUtils.createArtifactUpsertRequest(ml.comet.experiment.impl.utils.RestApiUtils.createArtifactUpsertRequest) LoggedExperimentAsset(ml.comet.experiment.asset.LoggedExperimentAsset) EXPERIMENT_LIVE(ml.comet.experiment.impl.resources.LogMessages.EXPERIMENT_LIVE) ArtifactDownloadException(ml.comet.experiment.artifact.ArtifactDownloadException) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) RestApiUtils.createLogEndTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogEndTimeRequest) StringUtils(org.apache.commons.lang3.StringUtils) ExperimentMetadata(ml.comet.experiment.model.ExperimentMetadata) FAILED_TO_DOWNLOAD_ASSET_FILE_ALREADY_EXISTS(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DOWNLOAD_ASSET_FILE_ALREADY_EXISTS) SOURCE_CODE(ml.comet.experiment.impl.asset.AssetType.SOURCE_CODE) RestApiUtils.createGraphRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGraphRequest) Duration(java.time.Duration) RestApiUtils.createLogMetricRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogMetricRequest) Path(java.nio.file.Path) SdkErrorCodes.artifactVersionStateNotClosed(ml.comet.experiment.impl.constants.SdkErrorCodes.artifactVersionStateNotClosed) FAILED_TO_DELETE_TEMPORARY_ASSET_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DELETE_TEMPORARY_ASSET_FILE) NonNull(lombok.NonNull) AssetUtils.createAssetFromData(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromData) FAILED_TO_DOWNLOAD_ASSET(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DOWNLOAD_ASSET) ARTIFACT_NOT_FOUND(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_NOT_FOUND) FAILED_TO_UPSERT_ARTIFACT(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_UPSERT_ARTIFACT) StandardCharsets(java.nio.charset.StandardCharsets) SdkErrorCodes.noArtifactFound(ml.comet.experiment.impl.constants.SdkErrorCodes.noArtifactFound) SdkErrorCodes.artifactVersionStateNotClosedErrorOccurred(ml.comet.experiment.impl.constants.SdkErrorCodes.artifactVersionStateNotClosedErrorOccurred) ARTIFACT_DOWNLOAD_FILE_OVERWRITTEN(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_DOWNLOAD_FILE_OVERWRITTEN) FAILED_TO_RESOLVE_ASSET_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_RESOLVE_ASSET_FILE) Experiment(ml.comet.experiment.Experiment) DownloadArtifactAssetOptions(ml.comet.experiment.impl.asset.DownloadArtifactAssetOptions) Optional.empty(java.util.Optional.empty) Single(io.reactivex.rxjava3.core.Single) FAILED_TO_COMPARE_CONTENT_OF_FILES(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_COMPARE_CONTENT_OF_FILES) ArtifactNotFoundException(ml.comet.experiment.artifact.ArtifactNotFoundException) ArtifactRequest(ml.comet.experiment.impl.rest.ArtifactRequest) ArrayList(java.util.ArrayList) Artifact(ml.comet.experiment.artifact.Artifact) ARTIFACT_VERSION_CREATED_WITHOUT_PREVIOUS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_VERSION_CREATED_WITHOUT_PREVIOUS) SystemUtils(ml.comet.experiment.impl.utils.SystemUtils) ALL(ml.comet.experiment.impl.asset.AssetType.ALL) FAILED_REGISTER_EXPERIMENT(ml.comet.experiment.impl.resources.LogMessages.FAILED_REGISTER_EXPERIMENT) GitMetaData(ml.comet.experiment.model.GitMetaData) RestApiResponse(ml.comet.experiment.impl.rest.RestApiResponse) Files(java.nio.file.Files) IOException(java.io.IOException) ExperimentContext(ml.comet.experiment.context.ExperimentContext) File(java.io.File) ARTIFACT_NOT_READY(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_NOT_READY) ExecutionException(java.util.concurrent.ExecutionException) EXPERIMENT_CREATED(ml.comet.experiment.impl.resources.LogMessages.EXPERIMENT_CREATED) Function(io.reactivex.rxjava3.functions.Function) CometGeneralException(ml.comet.experiment.exception.CometGeneralException) AssetUtils.createAssetFromFile(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromFile) ArtifactVersionAssetResponse(ml.comet.experiment.impl.rest.ArtifactVersionAssetResponse) ExperimentStatusResponse(ml.comet.experiment.impl.rest.ExperimentStatusResponse) ArtifactEntry(ml.comet.experiment.impl.rest.ArtifactEntry) RestApiUtils.createLogParamRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogParamRequest) RestApiUtils.createLogStartTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogStartTimeRequest) AssetImpl(ml.comet.experiment.impl.asset.AssetImpl) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) ArtifactException(ml.comet.experiment.artifact.ArtifactException) RestApiUtils.createLogLineRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogLineRequest) RestApiUtils.createGitMetadataRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGitMetadataRequest) ARTIFACT_VERSION_CREATED_WITH_PREVIOUS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_VERSION_CREATED_WITH_PREVIOUS) CreateExperimentRequest(ml.comet.experiment.impl.rest.CreateExperimentRequest) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) LogMessages.getString(ml.comet.experiment.impl.resources.LogMessages.getString) Collection(java.util.Collection) RestApiUtils.createLogHtmlRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogHtmlRequest) ArtifactVersionDetail(ml.comet.experiment.impl.rest.ArtifactVersionDetail) GET_ARTIFACT_FAILED_UNEXPECTEDLY(ml.comet.experiment.impl.resources.LogMessages.GET_ARTIFACT_FAILED_UNEXPECTEDLY) Value(ml.comet.experiment.model.Value) List(java.util.List) FAILED_TO_CREATE_TEMPORARY_ASSET_DOWNLOAD_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_CREATE_TEMPORARY_ASSET_DOWNLOAD_FILE) FAILED_TO_READ_DOWNLOADED_FILE_SIZE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_READ_DOWNLOADED_FILE_SIZE) BiFunction(io.reactivex.rxjava3.functions.BiFunction) Disposable(io.reactivex.rxjava3.disposables.Disposable) Optional(java.util.Optional) GetArtifactOptions(ml.comet.experiment.artifact.GetArtifactOptions) MinMaxResponse(ml.comet.experiment.impl.rest.MinMaxResponse) CreateExperimentResponse(ml.comet.experiment.impl.rest.CreateExperimentResponse) Getter(lombok.Getter) CompletableFuture(java.util.concurrent.CompletableFuture) ArtifactAssetImpl(ml.comet.experiment.impl.asset.ArtifactAssetImpl) ExceptionUtils(ml.comet.experiment.impl.utils.ExceptionUtils) AssetOverwriteStrategy(ml.comet.experiment.artifact.AssetOverwriteStrategy) ARTIFACT_HAS_NO_DETAILS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_HAS_NO_DETAILS) RestApiUtils.createTagRequest(ml.comet.experiment.impl.utils.RestApiUtils.createTagRequest) InvalidArtifactStateException(ml.comet.experiment.artifact.InvalidArtifactStateException) REMOTE_ASSET_CANNOT_BE_DOWNLOADED(ml.comet.experiment.impl.resources.LogMessages.REMOTE_ASSET_CANNOT_BE_DOWNLOADED) COMPLETED_DOWNLOAD_ARTIFACT_ASSET(ml.comet.experiment.impl.resources.LogMessages.COMPLETED_DOWNLOAD_ARTIFACT_ASSET) FAILED_TO_UPDATE_ARTIFACT_VERSION_STATE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_UPDATE_ARTIFACT_VERSION_STATE) ArtifactVersionState(ml.comet.experiment.impl.rest.ArtifactVersionState) RestApiUtils.createLogOtherRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogOtherRequest) RestApiUtils.createArtifactVersionStateRequest(ml.comet.experiment.impl.utils.RestApiUtils.createArtifactVersionStateRequest) ArtifactDto(ml.comet.experiment.impl.rest.ArtifactDto) CometUtils(ml.comet.experiment.impl.utils.CometUtils) ARTIFACT_ASSETS_FILE_EXISTS_PRESERVING(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_ASSETS_FILE_EXISTS_PRESERVING) Logger(org.slf4j.Logger) FileUtils(ml.comet.experiment.impl.utils.FileUtils) ConnectionInitializer(ml.comet.experiment.impl.http.ConnectionInitializer) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) CometApiException(ml.comet.experiment.exception.CometApiException) FAILED_TO_READ_LOGGED_ARTIFACT_ASSETS(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_READ_LOGGED_ARTIFACT_ASSETS) FAILED_READ_DATA_FOR_EXPERIMENT(ml.comet.experiment.impl.resources.LogMessages.FAILED_READ_DATA_FOR_EXPERIMENT) ArtifactRequest(ml.comet.experiment.impl.rest.ArtifactRequest) ArtifactEntry(ml.comet.experiment.impl.rest.ArtifactEntry) ArtifactException(ml.comet.experiment.artifact.ArtifactException)

Example 2 with Artifact

use of ml.comet.experiment.artifact.Artifact in project comet-java-sdk by comet-ml.

the class ArtifactSupportTest method testLogAndGetArtifact.

@Test
public void testLogAndGetArtifact() {
    try (OnlineExperimentImpl experiment = (OnlineExperimentImpl) createOnlineExperiment()) {
        ArtifactImpl artifact = createArtifact();
        // add remote assets
        // 
        URI firstAssetLink = new URI("s3://bucket/folder/firstAssetFile.extension");
        String firstAssetFileName = "firstAssetFileName";
        artifact.addRemoteAsset(firstAssetLink, firstAssetFileName);
        String secondAssetExpectedFileName = "secondAssetFile.extension";
        URI secondAssetLink = new URI("s3://bucket/folder/" + secondAssetExpectedFileName);
        artifact.addRemoteAsset(secondAssetLink, secondAssetExpectedFileName);
        // add local assets
        // 
        artifact.addAsset(Objects.requireNonNull(TestUtils.getFile(IMAGE_FILE_NAME)), IMAGE_FILE_NAME, false, SOME_METADATA);
        artifact.addAsset(Objects.requireNonNull(TestUtils.getFile(CODE_FILE_NAME)), CODE_FILE_NAME, false);
        byte[] someData = "some data".getBytes(StandardCharsets.UTF_8);
        String someDataName = "someDataName";
        artifact.addAsset(someData, someDataName);
        // add assets folder
        // 
        artifact.addAssetFolder(assetsFolder.toFile(), true, true);
        // the logged artifact validator
        Function4<LoggedArtifact, ArtifactImpl, String, List<String>, Void> loggedArtifactValidator = (actual, original, experimentKey, expectedAliases) -> {
            assertNotNull(actual, "logged artifact expected");
            assertEquals(original.getType(), actual.getArtifactType(), "wrong artifact type");
            assertEquals(new HashSet<>(expectedAliases), actual.getAliases(), "wrong aliases");
            assertEquals(SOME_METADATA, actual.getMetadata(), "wrong metadata");
            assertEquals(new HashSet<>(original.getVersionTags()), actual.getVersionTags(), "wrong version tags");
            assertEquals(WORKSPACE_NAME, actual.getWorkspace(), "wrong workspace");
            assertEquals(experimentKey, actual.getSourceExperimentKey(), "wrong experiment key");
            assertEquals(original.getName(), actual.getName(), "wrong artifact name");
            return null;
        };
        // check artifacts-in-progress counter before
        assertEquals(0, experiment.getArtifactsInProgress().get(), "artifacts-in-progress counter must be zero at start");
        // log artifact and check results
        // 
        CompletableFuture<LoggedArtifact> futureArtifact = experiment.logArtifact(artifact);
        // check artifacts-in-progress counter while in progress
        assertEquals(1, experiment.getArtifactsInProgress().get(), "artifacts-in-progress counter has wrong value while still in progress");
        LoggedArtifact loggedArtifact = futureArtifact.get(60, SECONDS);
        // check artifacts-in-progress counter after
        Awaitility.await("artifacts-in-progress counter must be decreased").pollInterval(10, TimeUnit.MILLISECONDS).atMost(1, TimeUnit.SECONDS).until(() -> experiment.getArtifactsInProgress().get() == 0);
        assertEquals(0, experiment.getArtifactsInProgress().get(), "artifacts-in-progress counter must be zero after log operation completed");
        List<String> expectedAliases = new ArrayList<>(artifact.getAliases());
        loggedArtifactValidator.apply(loggedArtifact, artifact, experiment.getExperimentKey(), expectedAliases);
        // get artifact details from server and check its correctness
        // 
        LoggedArtifact loggedArtifactFromServer = experiment.getArtifact(loggedArtifact.getName(), loggedArtifact.getWorkspace(), loggedArtifact.getVersion());
        // added by the backend automatically
        expectedAliases.add(ALIAS_LATEST);
        loggedArtifactValidator.apply(loggedArtifactFromServer, artifact, experiment.getExperimentKey(), expectedAliases);
        // check that correct assets was logged
        // 
        Collection<LoggedArtifactAsset> loggedAssets = loggedArtifactFromServer.getAssets();
        Collection<ArtifactAsset> assets = artifact.getAssets();
        assertEquals(assets.size(), loggedAssets.size(), "wrong size");
        loggedAssets.forEach(loggedArtifactAsset -> validateArtifactAsset(new ArtifactAssetImpl((LoggedArtifactAssetImpl) loggedArtifactAsset), assets));
    } catch (Throwable t) {
        fail(t);
    }
}
Also used : Arrays(java.util.Arrays) ArtifactAssetNotFoundException(ml.comet.experiment.artifact.ArtifactAssetNotFoundException) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) ArtifactException(ml.comet.experiment.artifact.ArtifactException) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Map(java.util.Map) FAILED_TO_DOWNLOAD_ARTIFACT_ASSETS(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DOWNLOAD_ARTIFACT_ASSETS) Tag(org.junit.jupiter.api.Tag) URI(java.net.URI) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) Path(java.nio.file.Path) LogMessages.getString(ml.comet.experiment.impl.resources.LogMessages.getString) Collection(java.util.Collection) Set(java.util.Set) UNKNOWN(ml.comet.experiment.impl.asset.AssetType.UNKNOWN) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) Objects(java.util.Objects) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) Stream(java.util.stream.Stream) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Awaitility(org.awaitility.Awaitility) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.fail(org.junit.jupiter.api.Assertions.fail) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SOME_METADATA(ml.comet.experiment.impl.ArtifactImplTest.SOME_METADATA) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ASSET(ml.comet.experiment.impl.asset.AssetType.ASSET) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) ArtifactAssetImpl(ml.comet.experiment.impl.asset.ArtifactAssetImpl) ArrayList(java.util.ArrayList) Function4(io.reactivex.rxjava3.functions.Function4) HashSet(java.util.HashSet) AssetOverwriteStrategy(ml.comet.experiment.artifact.AssetOverwriteStrategy) Artifact(ml.comet.experiment.artifact.Artifact) REMOTE_ASSET_CANNOT_BE_DOWNLOADED(ml.comet.experiment.impl.resources.LogMessages.REMOTE_ASSET_CANNOT_BE_DOWNLOADED) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ExperimentTestFactory.createOnlineExperiment(ml.comet.experiment.impl.ExperimentTestFactory.createOnlineExperiment) DownloadedArtifact(ml.comet.experiment.artifact.DownloadedArtifact) Files(java.nio.file.Files) IOException(java.io.IOException) File(java.io.File) DisplayName(org.junit.jupiter.api.DisplayName) TimeUnit(java.util.concurrent.TimeUnit) Assertions.assertArrayEquals(org.junit.jupiter.api.Assertions.assertArrayEquals) WORKSPACE_NAME(ml.comet.experiment.impl.ExperimentTestFactory.WORKSPACE_NAME) PathUtils(org.apache.commons.io.file.PathUtils) Timeout(org.junit.jupiter.api.Timeout) Collections(java.util.Collections) SECONDS(java.util.concurrent.TimeUnit.SECONDS) InputStream(java.io.InputStream) FAILED_TO_FIND_ASSET_IN_ARTIFACT(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_FIND_ASSET_IN_ARTIFACT) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) ArrayList(java.util.ArrayList) LogMessages.getString(ml.comet.experiment.impl.resources.LogMessages.getString) URI(java.net.URI) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) ArtifactAssetImpl(ml.comet.experiment.impl.asset.ArtifactAssetImpl) List(java.util.List) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 3 with Artifact

use of ml.comet.experiment.artifact.Artifact 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);
    }
}
Also used : Connection(ml.comet.experiment.impl.http.Connection) RestApiUtils.createArtifactUpsertRequest(ml.comet.experiment.impl.utils.RestApiUtils.createArtifactUpsertRequest) LoggedExperimentAsset(ml.comet.experiment.asset.LoggedExperimentAsset) EXPERIMENT_LIVE(ml.comet.experiment.impl.resources.LogMessages.EXPERIMENT_LIVE) ArtifactDownloadException(ml.comet.experiment.artifact.ArtifactDownloadException) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) RestApiUtils.createLogEndTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogEndTimeRequest) StringUtils(org.apache.commons.lang3.StringUtils) ExperimentMetadata(ml.comet.experiment.model.ExperimentMetadata) FAILED_TO_DOWNLOAD_ASSET_FILE_ALREADY_EXISTS(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DOWNLOAD_ASSET_FILE_ALREADY_EXISTS) SOURCE_CODE(ml.comet.experiment.impl.asset.AssetType.SOURCE_CODE) RestApiUtils.createGraphRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGraphRequest) Duration(java.time.Duration) RestApiUtils.createLogMetricRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogMetricRequest) Path(java.nio.file.Path) SdkErrorCodes.artifactVersionStateNotClosed(ml.comet.experiment.impl.constants.SdkErrorCodes.artifactVersionStateNotClosed) FAILED_TO_DELETE_TEMPORARY_ASSET_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DELETE_TEMPORARY_ASSET_FILE) NonNull(lombok.NonNull) AssetUtils.createAssetFromData(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromData) FAILED_TO_DOWNLOAD_ASSET(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_DOWNLOAD_ASSET) ARTIFACT_NOT_FOUND(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_NOT_FOUND) FAILED_TO_UPSERT_ARTIFACT(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_UPSERT_ARTIFACT) StandardCharsets(java.nio.charset.StandardCharsets) SdkErrorCodes.noArtifactFound(ml.comet.experiment.impl.constants.SdkErrorCodes.noArtifactFound) SdkErrorCodes.artifactVersionStateNotClosedErrorOccurred(ml.comet.experiment.impl.constants.SdkErrorCodes.artifactVersionStateNotClosedErrorOccurred) ARTIFACT_DOWNLOAD_FILE_OVERWRITTEN(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_DOWNLOAD_FILE_OVERWRITTEN) FAILED_TO_RESOLVE_ASSET_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_RESOLVE_ASSET_FILE) Experiment(ml.comet.experiment.Experiment) DownloadArtifactAssetOptions(ml.comet.experiment.impl.asset.DownloadArtifactAssetOptions) Optional.empty(java.util.Optional.empty) Single(io.reactivex.rxjava3.core.Single) FAILED_TO_COMPARE_CONTENT_OF_FILES(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_COMPARE_CONTENT_OF_FILES) ArtifactNotFoundException(ml.comet.experiment.artifact.ArtifactNotFoundException) ArtifactRequest(ml.comet.experiment.impl.rest.ArtifactRequest) ArrayList(java.util.ArrayList) Artifact(ml.comet.experiment.artifact.Artifact) ARTIFACT_VERSION_CREATED_WITHOUT_PREVIOUS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_VERSION_CREATED_WITHOUT_PREVIOUS) SystemUtils(ml.comet.experiment.impl.utils.SystemUtils) ALL(ml.comet.experiment.impl.asset.AssetType.ALL) FAILED_REGISTER_EXPERIMENT(ml.comet.experiment.impl.resources.LogMessages.FAILED_REGISTER_EXPERIMENT) GitMetaData(ml.comet.experiment.model.GitMetaData) RestApiResponse(ml.comet.experiment.impl.rest.RestApiResponse) Files(java.nio.file.Files) IOException(java.io.IOException) ExperimentContext(ml.comet.experiment.context.ExperimentContext) File(java.io.File) ARTIFACT_NOT_READY(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_NOT_READY) ExecutionException(java.util.concurrent.ExecutionException) EXPERIMENT_CREATED(ml.comet.experiment.impl.resources.LogMessages.EXPERIMENT_CREATED) Function(io.reactivex.rxjava3.functions.Function) CometGeneralException(ml.comet.experiment.exception.CometGeneralException) AssetUtils.createAssetFromFile(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromFile) ArtifactVersionAssetResponse(ml.comet.experiment.impl.rest.ArtifactVersionAssetResponse) ExperimentStatusResponse(ml.comet.experiment.impl.rest.ExperimentStatusResponse) ArtifactEntry(ml.comet.experiment.impl.rest.ArtifactEntry) RestApiUtils.createLogParamRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogParamRequest) RestApiUtils.createLogStartTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogStartTimeRequest) AssetImpl(ml.comet.experiment.impl.asset.AssetImpl) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) ArtifactException(ml.comet.experiment.artifact.ArtifactException) RestApiUtils.createLogLineRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogLineRequest) RestApiUtils.createGitMetadataRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGitMetadataRequest) ARTIFACT_VERSION_CREATED_WITH_PREVIOUS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_VERSION_CREATED_WITH_PREVIOUS) CreateExperimentRequest(ml.comet.experiment.impl.rest.CreateExperimentRequest) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) LogMessages.getString(ml.comet.experiment.impl.resources.LogMessages.getString) Collection(java.util.Collection) RestApiUtils.createLogHtmlRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogHtmlRequest) ArtifactVersionDetail(ml.comet.experiment.impl.rest.ArtifactVersionDetail) GET_ARTIFACT_FAILED_UNEXPECTEDLY(ml.comet.experiment.impl.resources.LogMessages.GET_ARTIFACT_FAILED_UNEXPECTEDLY) Value(ml.comet.experiment.model.Value) List(java.util.List) FAILED_TO_CREATE_TEMPORARY_ASSET_DOWNLOAD_FILE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_CREATE_TEMPORARY_ASSET_DOWNLOAD_FILE) FAILED_TO_READ_DOWNLOADED_FILE_SIZE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_READ_DOWNLOADED_FILE_SIZE) BiFunction(io.reactivex.rxjava3.functions.BiFunction) Disposable(io.reactivex.rxjava3.disposables.Disposable) Optional(java.util.Optional) GetArtifactOptions(ml.comet.experiment.artifact.GetArtifactOptions) MinMaxResponse(ml.comet.experiment.impl.rest.MinMaxResponse) CreateExperimentResponse(ml.comet.experiment.impl.rest.CreateExperimentResponse) Getter(lombok.Getter) CompletableFuture(java.util.concurrent.CompletableFuture) ArtifactAssetImpl(ml.comet.experiment.impl.asset.ArtifactAssetImpl) ExceptionUtils(ml.comet.experiment.impl.utils.ExceptionUtils) AssetOverwriteStrategy(ml.comet.experiment.artifact.AssetOverwriteStrategy) ARTIFACT_HAS_NO_DETAILS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_HAS_NO_DETAILS) RestApiUtils.createTagRequest(ml.comet.experiment.impl.utils.RestApiUtils.createTagRequest) InvalidArtifactStateException(ml.comet.experiment.artifact.InvalidArtifactStateException) REMOTE_ASSET_CANNOT_BE_DOWNLOADED(ml.comet.experiment.impl.resources.LogMessages.REMOTE_ASSET_CANNOT_BE_DOWNLOADED) COMPLETED_DOWNLOAD_ARTIFACT_ASSET(ml.comet.experiment.impl.resources.LogMessages.COMPLETED_DOWNLOAD_ARTIFACT_ASSET) FAILED_TO_UPDATE_ARTIFACT_VERSION_STATE(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_UPDATE_ARTIFACT_VERSION_STATE) ArtifactVersionState(ml.comet.experiment.impl.rest.ArtifactVersionState) RestApiUtils.createLogOtherRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogOtherRequest) RestApiUtils.createArtifactVersionStateRequest(ml.comet.experiment.impl.utils.RestApiUtils.createArtifactVersionStateRequest) ArtifactDto(ml.comet.experiment.impl.rest.ArtifactDto) CometUtils(ml.comet.experiment.impl.utils.CometUtils) ARTIFACT_ASSETS_FILE_EXISTS_PRESERVING(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_ASSETS_FILE_EXISTS_PRESERVING) Logger(org.slf4j.Logger) FileUtils(ml.comet.experiment.impl.utils.FileUtils) ConnectionInitializer(ml.comet.experiment.impl.http.ConnectionInitializer) FileAlreadyExistsException(java.nio.file.FileAlreadyExistsException) CometApiException(ml.comet.experiment.exception.CometApiException) FAILED_TO_READ_LOGGED_ARTIFACT_ASSETS(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_READ_LOGGED_ARTIFACT_ASSETS) FAILED_READ_DATA_FOR_EXPERIMENT(ml.comet.experiment.impl.resources.LogMessages.FAILED_READ_DATA_FOR_EXPERIMENT) ArtifactDto(ml.comet.experiment.impl.rest.ArtifactDto) InvalidArtifactStateException(ml.comet.experiment.artifact.InvalidArtifactStateException) ArtifactException(ml.comet.experiment.artifact.ArtifactException) ArtifactVersionDetail(ml.comet.experiment.impl.rest.ArtifactVersionDetail) ArtifactNotFoundException(ml.comet.experiment.artifact.ArtifactNotFoundException) CometApiException(ml.comet.experiment.exception.CometApiException)

Example 4 with Artifact

use of ml.comet.experiment.artifact.Artifact in project comet-java-sdk by comet-ml.

the class BaseExperimentAsync method sendArtifactAssetAsync.

/**
 * Attempts to send given {@link ArtifactAsset} or its subclass asynchronously.
 *
 * @param asset the artifact asset.
 * @param <T>   the type of the artifact asset.
 * @return the {@link Single} which can be used to subscribe for operation results.
 */
private <T extends ArtifactAsset> Single<RestApiResponse> sendArtifactAssetAsync(@NonNull final T asset) {
    Single<RestApiResponse> single;
    Scheduler scheduler = Schedulers.io();
    if (asset.isRemote()) {
        // remote asset
        single = validateAndGetExperimentKey().subscribeOn(scheduler).concatMap(experimentKey -> getRestApiClient().logRemoteAsset((RemoteAsset) asset, experimentKey));
    } else {
        // local asset
        single = validateAndGetExperimentKey().subscribeOn(scheduler).concatMap(experimentKey -> getRestApiClient().logAsset(asset, experimentKey));
    }
    return single.doOnSuccess(restApiResponse -> checkAndLogAssetResponse(restApiResponse, getLogger(), asset)).doOnError(throwable -> getLogger().error(getString(FAILED_TO_SEND_LOG_ARTIFACT_ASSET_REQUEST, asset), throwable));
}
Also used : RestApiUtils.createLogParamRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogParamRequest) RestApiUtils.createLogStartTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogStartTimeRequest) AssetImpl(ml.comet.experiment.impl.asset.AssetImpl) RemoteAssetImpl(ml.comet.experiment.impl.asset.RemoteAssetImpl) FAILED_TO_FINALIZE_ARTIFACT_VERSION(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_FINALIZE_ARTIFACT_VERSION) RestApiUtils.createLogEndTimeRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogEndTimeRequest) StringUtils(org.apache.commons.lang3.StringUtils) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) ArtifactException(ml.comet.experiment.artifact.ArtifactException) RemoteAsset(ml.comet.experiment.asset.RemoteAsset) OutputUpdate(ml.comet.experiment.impl.rest.OutputUpdate) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) RestApiUtils.createGraphRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGraphRequest) Duration(java.time.Duration) Map(java.util.Map) ARTIFACT_UPLOAD_STARTED(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_UPLOAD_STARTED) RestApiUtils.createLogLineRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogLineRequest) RestApiUtils.createGitMetadataRequest(ml.comet.experiment.impl.utils.RestApiUtils.createGitMetadataRequest) URI(java.net.URI) RestApiUtils.createLogMetricRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogMetricRequest) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) LogMessages.getString(ml.comet.experiment.impl.resources.LogMessages.getString) FAILED_TO_SEND_LOG_REQUEST(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_SEND_LOG_REQUEST) FAILED_TO_LOG_ASSET_FOLDER(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_LOG_ASSET_FOLDER) FAILED_TO_UPLOAD_SOME_ARTIFACT_ASSET(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_UPLOAD_SOME_ARTIFACT_ASSET) NonNull(lombok.NonNull) AssetUtils.createAssetFromData(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromData) RestApiUtils.createLogHtmlRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogHtmlRequest) Action(io.reactivex.rxjava3.functions.Action) HtmlRest(ml.comet.experiment.impl.rest.HtmlRest) AssetType(ml.comet.experiment.impl.asset.AssetType) Objects(java.util.Objects) Stream(java.util.stream.Stream) Asset(ml.comet.experiment.asset.Asset) BiFunction(io.reactivex.rxjava3.functions.BiFunction) AssetUtils(ml.comet.experiment.impl.utils.AssetUtils) Optional(java.util.Optional) FAILED_TO_SEND_LOG_ASSET_REQUEST(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_SEND_LOG_ASSET_REQUEST) Optional.empty(java.util.Optional.empty) Single(io.reactivex.rxjava3.core.Single) ASSETS_FOLDER_UPLOAD_COMPLETED(ml.comet.experiment.impl.resources.LogMessages.ASSETS_FOLDER_UPLOAD_COMPLETED) CompletableFuture(java.util.concurrent.CompletableFuture) ArtifactAssetImpl(ml.comet.experiment.impl.asset.ArtifactAssetImpl) Schedulers(io.reactivex.rxjava3.schedulers.Schedulers) MetricRest(ml.comet.experiment.impl.rest.MetricRest) RestApiUtils.createTagRequest(ml.comet.experiment.impl.utils.RestApiUtils.createTagRequest) ParameterRest(ml.comet.experiment.impl.rest.ParameterRest) Artifact(ml.comet.experiment.artifact.Artifact) Observable(io.reactivex.rxjava3.core.Observable) Scheduler(io.reactivex.rxjava3.core.Scheduler) LogOtherRest(ml.comet.experiment.impl.rest.LogOtherRest) ArtifactVersionState(ml.comet.experiment.impl.rest.ArtifactVersionState) RestApiUtils.createLogOtherRequest(ml.comet.experiment.impl.utils.RestApiUtils.createLogOtherRequest) GitMetaData(ml.comet.experiment.model.GitMetaData) RestApiResponse(ml.comet.experiment.impl.rest.RestApiResponse) Logger(org.slf4j.Logger) ARTIFACT_LOGGED_WITHOUT_ASSETS(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_LOGGED_WITHOUT_ASSETS) ExperimentContext(ml.comet.experiment.context.ExperimentContext) File(java.io.File) ARTIFACT_UPLOAD_COMPLETED(ml.comet.experiment.impl.resources.LogMessages.ARTIFACT_UPLOAD_COMPLETED) LOG_REMOTE_ASSET_URI_FILE_NAME_TO_DEFAULT(ml.comet.experiment.impl.resources.LogMessages.LOG_REMOTE_ASSET_URI_FILE_NAME_TO_DEFAULT) FAILED_TO_SEND_LOG_ARTIFACT_ASSET_REQUEST(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_SEND_LOG_ARTIFACT_ASSET_REQUEST) AssetUtils.createAssetFromFile(ml.comet.experiment.impl.utils.AssetUtils.createAssetFromFile) LOG_ASSET_FOLDER_EMPTY(ml.comet.experiment.impl.resources.LogMessages.LOG_ASSET_FOLDER_EMPTY) FAILED_TO_LOG_SOME_ASSET_FROM_FOLDER(ml.comet.experiment.impl.resources.LogMessages.FAILED_TO_LOG_SOME_ASSET_FROM_FOLDER) ArtifactEntry(ml.comet.experiment.impl.rest.ArtifactEntry) Op(ml.comet.experiment.artifact.GetArtifactOptions.Op) Scheduler(io.reactivex.rxjava3.core.Scheduler) RestApiResponse(ml.comet.experiment.impl.rest.RestApiResponse)

Example 5 with Artifact

use of ml.comet.experiment.artifact.Artifact in project comet-java-sdk by comet-ml.

the class ArtifactExample method run.

private static void run(OnlineExperiment experiment) throws Exception {
    experiment.setExperimentName("Artifact Example");
    Map<String, Object> metadata = BaseExample.createMetaData();
    List<String> aliases = Arrays.asList("alias1", "alias2");
    List<String> tags = Arrays.asList("tag1", "tag2");
    String artifactName = "someArtifact";
    String artifactType = "someType";
    Artifact artifact = Artifact.newArtifact(artifactName, artifactType).withAliases(aliases).withVersionTags(tags).withMetadata(metadata).build();
    // add remote assets
    // 
    URI firstAssetLink = new URI("s3://bucket/folder/firstAssetFile.extension");
    String firstAssetFileName = "firstAssetFileName";
    artifact.addRemoteAsset(firstAssetLink, firstAssetFileName);
    String secondAssetExpectedFileName = "secondAssetFile.extension";
    URI secondAssetLink = new URI("s3://bucket/folder/" + secondAssetExpectedFileName);
    artifact.addRemoteAsset(secondAssetLink, secondAssetExpectedFileName);
    // add local assets
    // 
    artifact.addAsset(getResourceFile(CHART_IMAGE_FILE), AMAZING_CHART_NAME, false, metadata);
    artifact.addAsset(getResourceFile(MODEL_FILE), false);
    byte[] someData = "some data".getBytes(StandardCharsets.UTF_8);
    String someDataName = "someDataName";
    artifact.addAsset(someData, someDataName);
    // add assets folder
    // 
    Path assetDir = BaseExample.copyResourcesToTmpDir();
    artifact.addAssetFolder(assetDir.toFile(), true, true);
    // log artifact
    // 
    CompletableFuture<LoggedArtifact> futureArtifact = experiment.logArtifact(artifact);
    LoggedArtifact loggedArtifact = futureArtifact.get(60, SECONDS);
    System.out.printf("\nArtifact upload complete: %s\n\n", loggedArtifact.getFullName());
    // get logged assets
    // 
    Collection<LoggedArtifactAsset> loggedAssets = loggedArtifact.getAssets();
    System.out.printf("Received %d logged artifact assets from the Comet server. Downloading asset files...\n", loggedAssets.size());
    // download artifact assets to the local directory one by one
    // 
    final Path assetsTmpDir = Files.createTempDirectory("ArtifactExampleAssets");
    loggedAssets.forEach(loggedArtifactAsset -> {
        if (!loggedArtifactAsset.isRemote()) {
            ArtifactAsset asset = loggedArtifactAsset.download(assetsTmpDir);
            System.out.printf("Downloaded asset '%s' of size %d bytes to '%s'\n", asset.getLogicalPath(), asset.getSize().orElse(0L), asset.getFile());
        } else {
            URI uri = loggedArtifactAsset.getLink().orElse(null);
            System.out.printf("Skipping download of the remote asset %s. It must be downloaded using its URI '%s'\n", loggedArtifactAsset.getLogicalPath(), uri);
        }
    });
    System.out.printf("Assets of the artifact's '%s' successfully downloaded to the folder: %s\n\n", loggedArtifact.getFullName(), assetsTmpDir);
    // load content of the artifact asset into the memory
    // 
    LoggedArtifactAsset asset = loggedAssets.stream().filter(loggedArtifactAsset -> {
        Long size = loggedArtifactAsset.getSize().orElse(0L);
        return !loggedArtifactAsset.isRemote() && size > 0;
    }).findFirst().orElse(null);
    if (asset != null) {
        System.out.printf("Loading content of the artifact asset '%s' into memory\n", asset.getAssetId());
        int buffSize = 512;
        try (InputStream in = new BufferedInputStream(asset.openStream(), buffSize)) {
            // work with input stream
            byte[] buff = IOUtils.byteArray(buffSize);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            for (int count; (count = in.read(buff)) > 0; ) {
                out.write(buff, 0, count);
            }
            System.out.printf("Content of the asset '%s' successfully loaded into memory, data size: %d.\n\n", asset.getLogicalPath(), out.size());
        } catch (Throwable t) {
            System.err.printf("Failed to read asset data, reason: %s\n\n", t);
            throw t;
        }
    }
    // download artifact to the local directory
    // 
    final Path artifactTmpDir = Files.createTempDirectory("ArtifactExampleArtifact");
    System.out.printf("Downloading artifact to the folder: %s\n", artifactTmpDir.toFile().getAbsoluteFile());
    DownloadedArtifact downloadedArtifact = loggedArtifact.download(artifactTmpDir, AssetOverwriteStrategy.FAIL_IF_DIFFERENT);
    Collection<ArtifactAsset> assets = downloadedArtifact.getAssets();
    System.out.printf("Artifact '%s' successfully downloaded. Received %d artifact assets from the Comet server.\n\n", downloadedArtifact.getFullName(), assets.size());
    // update downloaded artifact
    // 
    System.out.printf("Starting update of the artifact: %s\n", downloadedArtifact.getFullName());
    downloadedArtifact.getAliases().add("downloaded");
    downloadedArtifact.getMetadata().put("updated", "someUpdatedValue");
    downloadedArtifact.addAsset(getResourceFile(GRAPH_JSON_FILE), "updated_graph.json", false, metadata);
    downloadedArtifact.incrementMinorVersion();
    CompletableFuture<LoggedArtifact> futureUpdatedArtifact = experiment.logArtifact(downloadedArtifact);
    loggedArtifact = futureUpdatedArtifact.get(60, SECONDS);
    System.out.printf("\nArtifact update completed, new artifact version created: %s\n\n", loggedArtifact.getFullName());
    // get artifact asset by logical path
    // 
    System.out.printf("Finding asset '%s' of the artifact: %s\n", AMAZING_CHART_NAME, loggedArtifact.getFullName());
    asset = loggedArtifact.getAsset(AMAZING_CHART_NAME);
    System.out.printf("Successfully found asset '%s' of the artifact: %s\n\n", asset, loggedArtifact.getFullName());
    System.out.println("===== Experiment completed ====");
}
Also used : Path(java.nio.file.Path) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) ArtifactAsset(ml.comet.experiment.artifact.ArtifactAsset) BufferedInputStream(java.io.BufferedInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) URI(java.net.URI) DownloadedArtifact(ml.comet.experiment.artifact.DownloadedArtifact) DownloadedArtifact(ml.comet.experiment.artifact.DownloadedArtifact) LoggedArtifact(ml.comet.experiment.artifact.LoggedArtifact) Artifact(ml.comet.experiment.artifact.Artifact) LoggedArtifactAsset(ml.comet.experiment.artifact.LoggedArtifactAsset) BufferedInputStream(java.io.BufferedInputStream)

Aggregations

Artifact (ml.comet.experiment.artifact.Artifact)6 ArtifactAsset (ml.comet.experiment.artifact.ArtifactAsset)6 LoggedArtifact (ml.comet.experiment.artifact.LoggedArtifact)6 File (java.io.File)5 Path (java.nio.file.Path)5 CompletableFuture (java.util.concurrent.CompletableFuture)5 ArtifactException (ml.comet.experiment.artifact.ArtifactException)5 LoggedArtifactAsset (ml.comet.experiment.artifact.LoggedArtifactAsset)5 ArtifactAssetImpl (ml.comet.experiment.impl.asset.ArtifactAssetImpl)5 LogMessages.getString (ml.comet.experiment.impl.resources.LogMessages.getString)5 IOException (java.io.IOException)4 URI (java.net.URI)4 StandardCharsets (java.nio.charset.StandardCharsets)4 Files (java.nio.file.Files)4 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4 List (java.util.List)4 AssetOverwriteStrategy (ml.comet.experiment.artifact.AssetOverwriteStrategy)4 REMOTE_ASSET_CANNOT_BE_DOWNLOADED (ml.comet.experiment.impl.resources.LogMessages.REMOTE_ASSET_CANNOT_BE_DOWNLOADED)4 Single (io.reactivex.rxjava3.core.Single)3