use of com.microsoft.azure.projectarcadia.common.ArcadiaWorkSpace in project azure-tools-for-java by Microsoft.
the class SparkBatchArcadiaSubmission method getJobDetailsWebUrl.
@NotNull
public URL getJobDetailsWebUrl(int livyId) {
Matcher matcher = LIVY_URL_NO_WORKSPACE_IN_HOSTNAME_PATTERN.matcher(getLivyUri().toString());
if (matcher.matches()) {
try {
ArcadiaWorkSpace workSpace = ArcadiaSparkComputeManager.getInstance().findWorkspace(getTenantId(), getWorkspaceName()).toBlocking().first();
// Currently we just concatenate the string and show it as the Spark job detail page URL.
// We don't check if the URL is valid or not because we have never met any exceptions when clicking the
// link during test. If there are errors reported by user that URL is invalid in the future, we will
// add more validation code here at that time.
URI rootUri = URI.create(this.webUrl == null ? SYNAPSE_STUDIO_WEB_ROOT_URL : this.webUrl).resolve("/");
return new URIBuilder(rootUri).setPath("/monitoring/sparkapplication/" + jobName).setParameters(Arrays.asList(new BasicNameValuePair("workspace", workSpace.getId()), new BasicNameValuePair("livyId", String.valueOf(livyId)), new BasicNameValuePair("sparkPoolName", matcher.group("pool")))).build().toURL();
} catch (NoSuchElementException ex) {
log().warn(String.format("Can't find workspace %s under tenant %s", getWorkspaceName(), getTenantId()), ex);
} catch (MalformedURLException | URISyntaxException ex) {
log().warn("Build Spark job detail web URL failed with error " + ex.getMessage(), ex);
throw new IllegalArgumentException("Bad Spark job detail URL", ex);
}
}
throw new IllegalArgumentException("Bad Synapse Livy URL: " + getLivyUri());
}
Aggregations