Search in sources :

Example 1 with LivySession

use of com.microsoft.azure.hdinsight.spark.jobs.livy.LivySession in project azure-tools-for-java by Microsoft.

the class JobUtils method getJobInformation.

public static String getJobInformation(@NotNull String allBatchesInformation, @NotNull String applicationId) {
    final Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create();
    final Type subscriptionsType = new TypeToken<LivyBatchesInformation>() {
    }.getType();
    final LivyBatchesInformation information = gson.fromJson(allBatchesInformation, subscriptionsType);
    final LivySession session = information.getSession(applicationId);
    String result = "Cannot get the Livy Log";
    if (session != null) {
        final String livyLog = session.getFormatLog();
        result = StringHelper.isNullOrWhiteSpace(livyLog) ? "No Livy Log" : livyLog;
    }
    return result;
}
Also used : LivySession(com.microsoft.azure.hdinsight.spark.jobs.livy.LivySession) ContentType(org.apache.http.entity.ContentType) MessageInfoType(com.microsoft.azure.hdinsight.common.MessageInfoType) Type(java.lang.reflect.Type) StorageAccountType(com.microsoft.azure.hdinsight.sdk.storage.StorageAccountType) LivyBatchesInformation(com.microsoft.azure.hdinsight.spark.jobs.livy.LivyBatchesInformation) GsonBuilder(com.google.gson.GsonBuilder) Gson(com.google.gson.Gson)

Aggregations

Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 MessageInfoType (com.microsoft.azure.hdinsight.common.MessageInfoType)1 StorageAccountType (com.microsoft.azure.hdinsight.sdk.storage.StorageAccountType)1 LivyBatchesInformation (com.microsoft.azure.hdinsight.spark.jobs.livy.LivyBatchesInformation)1 LivySession (com.microsoft.azure.hdinsight.spark.jobs.livy.LivySession)1 Type (java.lang.reflect.Type)1 ContentType (org.apache.http.entity.ContentType)1