Search in sources :

Example 1 with Warning

use of com.microsoft.azure.hdinsight.common.MessageInfoType.Warning in project azure-tools-for-java by Microsoft.

the class Session method deploy.

/*
     * Observable APIs, all IO operations
     */
public Observable<Session> deploy() {
    final Deployable deployDelegate = getDeploy();
    if (deployDelegate == null) {
        return Observable.just(this);
    }
    return Observable.from(getArtifactsToDeploy()).doOnNext(artifactPath -> ctrlSubject.onNext(new SparkLogLine(TOOL, Info, "Start uploading artifact " + artifactPath))).flatMap(artifactPath -> deployDelegate.deploy(new File(artifactPath), ctrlSubject)).doOnNext(uri -> ctrlSubject.onNext(new SparkLogLine(TOOL, Info, "Uploaded to " + uri))).toList().onErrorResumeNext(err -> {
        ctrlSubject.onNext(new SparkLogLine(TOOL, Warning, "Failed to upload artifact: " + err));
        ctrlSubject.onNext(new SparkLogLine(TOOL, Warning, "Try to start interactive session without those artifacts dependency..."));
        return Observable.empty();
    }).map(uploadedUris -> {
        this.createParameters.uploadedArtifactsUris.addAll(uploadedUris);
        return this;
    }).defaultIfEmpty(this);
}
Also used : java.util(java.util) Warning(com.microsoft.azure.hdinsight.common.MessageInfoType.Warning) SessionState(com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.SessionState) SessionKind(com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.SessionKind) SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) StringUtils(org.apache.commons.lang3.StringUtils) HDInsightLoader(com.microsoft.azure.hdinsight.common.HDInsightLoader) ILogger(com.microsoft.azure.hdinsight.common.logger.ILogger) Observable(rx.Observable) Info(com.microsoft.azure.hdinsight.common.MessageInfoType.Info) ImmutableList(com.google.common.collect.ImmutableList) ByteArrayInputStream(java.io.ByteArrayInputStream) Schedulers(rx.schedulers.Schedulers) Thread.sleep(java.lang.Thread.sleep) URI(java.net.URI) TOOL(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine.TOOL) PostSessions(com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.api.PostSessions) Debug(com.microsoft.azure.hdinsight.common.MessageInfoType.Debug) MemorySize(com.microsoft.azure.hdinsight.sdk.common.livy.MemorySize) Nullable(com.microsoft.azuretools.azurecommons.helpers.Nullable) ImmutableMap(com.google.common.collect.ImmutableMap) Exceptions.propagate(rx.exceptions.Exceptions.propagate) HttpResponse(com.microsoft.azure.hdinsight.sdk.common.HttpResponse) StringEntity(org.apache.http.entity.StringEntity) SessionNotStartException(com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.SessionNotStartException) Scheduler(rx.Scheduler) StatementExecutionError(com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.StatementExecutionError) Collectors(java.util.stream.Collectors) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) File(java.io.File) StandardCharsets(java.nio.charset.StandardCharsets) HttpObservable(com.microsoft.azure.hdinsight.sdk.common.HttpObservable) TimeUnit(java.util.concurrent.TimeUnit) Stream(java.util.stream.Stream) AppInsightsClient(com.microsoft.azuretools.telemetry.AppInsightsClient) Closeable(java.io.Closeable) ApplicationNotStartException(com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.ApplicationNotStartException) Deployable(com.microsoft.azure.hdinsight.spark.common.Deployable) SparkLogLine(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine) PublishSubject(rx.subjects.PublishSubject) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) Deployable(com.microsoft.azure.hdinsight.spark.common.Deployable) File(java.io.File) SparkLogLine(com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 HDInsightLoader (com.microsoft.azure.hdinsight.common.HDInsightLoader)1 Debug (com.microsoft.azure.hdinsight.common.MessageInfoType.Debug)1 Info (com.microsoft.azure.hdinsight.common.MessageInfoType.Info)1 Warning (com.microsoft.azure.hdinsight.common.MessageInfoType.Warning)1 ILogger (com.microsoft.azure.hdinsight.common.logger.ILogger)1 HttpObservable (com.microsoft.azure.hdinsight.sdk.common.HttpObservable)1 HttpResponse (com.microsoft.azure.hdinsight.sdk.common.HttpResponse)1 MemorySize (com.microsoft.azure.hdinsight.sdk.common.livy.MemorySize)1 ApplicationNotStartException (com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.ApplicationNotStartException)1 SessionNotStartException (com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.SessionNotStartException)1 StatementExecutionError (com.microsoft.azure.hdinsight.sdk.common.livy.interactive.exceptions.StatementExecutionError)1 SessionKind (com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.SessionKind)1 SessionState (com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.SessionState)1 PostSessions (com.microsoft.azure.hdinsight.sdk.rest.livy.interactive.api.PostSessions)1 Deployable (com.microsoft.azure.hdinsight.spark.common.Deployable)1 SparkLogLine (com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine)1 TOOL (com.microsoft.azure.hdinsight.spark.common.log.SparkLogLine.TOOL)1 Nullable (com.microsoft.azuretools.azurecommons.helpers.Nullable)1