use of com.microsoft.azure.hdinsight.sdk.rest.AttemptWithAppId in project azure-tools-for-java by Microsoft.
the class Application method getLastAttemptWithAppId.
public AttemptWithAppId getLastAttemptWithAppId(@NotNull String clusterName) {
final int attemptTimes = attempts.size();
Optional<Attempt> lastAttempt = attempts.stream().filter(attempt -> Integer.valueOf(attempt.getAttemptId()) == attemptTimes).findFirst();
return lastAttempt.isPresent() ? new AttemptWithAppId(clusterName, getId(), lastAttempt.get()) : null;
}
use of com.microsoft.azure.hdinsight.sdk.rest.AttemptWithAppId in project azure-tools-for-java by Microsoft.
the class SparkRestUtil method getSparkTasks.
public static List<Task> getSparkTasks(@NotNull ApplicationKey key, @NotNull int stage, int attemptId) throws IOException, ExecutionException, HDIException {
AttemptWithAppId attemptWithAppId = getLastAttemptFromLocalCache(key);
String url = String.format("/%s/%s/stages/%s/%s/taskList", attemptWithAppId.getAppId(), attemptWithAppId.getAttemptId(), stage, attemptId);
HttpEntity entity = getSparkRestEntity(key.getClusterDetails(), url);
Optional<List<Task>> tasks = ObjectConvertUtils.convertEntityToList(entity, Task.class);
return tasks.orElse(RestUtil.getEmptyList(Task.class));
}
use of com.microsoft.azure.hdinsight.sdk.rest.AttemptWithAppId in project azure-tools-for-java by Microsoft.
the class SparkRestUtil method getAllExecutorFromApp.
public static List<Executor> getAllExecutorFromApp(@NotNull ApplicationKey key) throws IOException, HDIException, ExecutionException {
final AttemptWithAppId attemptWithAppId = getLastAttemptFromLocalCache(key);
final HttpEntity entity = getSparkRestEntity(key.getClusterDetails(), String.format("/%s/%s/executors", attemptWithAppId.getAppId(), attemptWithAppId.getAttemptId()));
Optional<List<Executor>> executors = ObjectConvertUtils.convertEntityToList(entity, Executor.class);
return executors.orElse(RestUtil.getEmptyList(Executor.class));
}
use of com.microsoft.azure.hdinsight.sdk.rest.AttemptWithAppId in project azure-tools-for-java by Microsoft.
the class SparkRestUtil method getAllStageFromApp.
public static List<Stage> getAllStageFromApp(@NotNull ApplicationKey key) throws IOException, HDIException, ExecutionException {
final AttemptWithAppId attemptWithAppId = getLastAttemptFromLocalCache(key);
final HttpEntity entity = getSparkRestEntity(key.getClusterDetails(), String.format("/%s/%s/stages", attemptWithAppId.getAppId(), attemptWithAppId.getAttemptId()));
final Optional<List<Stage>> stages = ObjectConvertUtils.convertEntityToList(entity, Stage.class);
return stages.orElse(RestUtil.getEmptyList(Stage.class));
}
Aggregations