protected Observable prepareArtifact()

in src/main/java/com/microsoft/azure/spark/tools/processes/SparkBatchJobRemoteProcess.java [233:250]


    protected Observable<? extends SparkBatchJob> prepareArtifact() {
        File artifactToUpload = this.artifactPath;
        SparkBatchJob batchJob = getSparkJob();

        if (artifactToUpload != null && batchJob instanceof DeployableBatch) {
            return ((DeployableBatch) batchJob)
                    .deployAndUpdateOptions(artifactToUpload)
                    .onErrorResumeNext(err -> {
                        Throwable rootCause = err.getCause() != null ? err.getCause() : err;
                        return Observable.error(new SparkJobUploadArtifactException(
                                "Failed to upload Spark application artifacts: " + rootCause.getMessage(), rootCause));
                    })
                    .map(deployedBatch -> (SparkBatchJob) deployedBatch)
                    .subscribeOn(schedulers.processBarVisibleAsync("Deploy the jar file into cluster"));
        }

        return Observable.just(getSparkJob());
    }