File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/spark/common Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 3939import java .io .File ;
4040import java .net .URI ;
4141import java .net .URISyntaxException ;
42+ import java .util .regex .Matcher ;
43+ import java .util .regex .Pattern ;
4244
4345public class ADLSGen2Deploy implements Deployable , ILogger {
4446 @ NotNull
@@ -97,8 +99,12 @@ public Observable<String> deploy(@NotNull File src) {
9799
98100 @ Nullable
99101 private String getArtifactUploadedPath (String rootPath ) throws URISyntaxException {
100- //convert https://fullAccountName/fileSystem/sparksubmission/guid/artifact.jar to /SparkSubmission/xxxx
101- int index = rootPath .indexOf ("SparkSubmission" );
102- return String .format ("/%s" , rootPath .substring (index ));
102+ //convert https://fullAccountName/fileSystem/subfolder/guid/artifact.jar to /subfolder/xxxx
103+ Matcher m = Pattern .compile (SparkBatchJob .AdlsGen2RestfulPathPattern ).matcher (rootPath );
104+ if (m .find ()) {
105+ return m .group ("subpath" );
106+ }
107+
108+ throw new URISyntaxException (rootPath , "Cannot get valid artifact path" );
103109 }
104110}
Original file line number Diff line number Diff line change 6464
6565public class SparkBatchJob implements ISparkBatchJob , ILogger {
6666 public static final String WebHDFSPathPattern = "^(https?://)([^/]+)(/.*)?(/webhdfs/v1)(/.*)?$" ;
67- public static final String AdlsGen2RestfulPathPattern = "^(https://)(?<accountName>[^/.\\ s]+)(\\ .)(dfs\\ .core\\ .windows\\ .net)(/)(?<fileSystem>[^/.\\ s]+)(/[^/. \\ s]+)*/?$" ;
67+ public static final String AdlsGen2RestfulPathPattern = "^(https://)(?<accountName>[^/.\\ s]+)(\\ .)(dfs\\ .core\\ .windows\\ .net)(/)(?<fileSystem>[^/.\\ s]+)(?<subpath> /[^\\ s]+)*/?$" ;
6868
6969 @ Nullable
7070 private String currentLogUrl ;
You can’t perform that action at this time.
0 commit comments