use of com.thinkbiganalytics.kylo.spark.rest.model.job.SparkJobResponse in project kylo by Teradata.
the class BatchJobSupplier method get.
@Nonnull
@Override
public SparkJobResponse get() {
// Create the job
SparkJobResponse response = restClient.createJob(process, request);
// Wait for job to complete
while (response.getStatus() == SparkJobResponse.Status.PENDING) {
sleep(pollInterval);
response = restClient.getJobResult(process, response.getId()).orElseThrow(NoSuchElementException::new);
}
return response;
}
use of com.thinkbiganalytics.kylo.spark.rest.model.job.SparkJobResponse in project kylo by Teradata.
the class LivyRestModelTransformer method toJobResponse.
@Nonnull
public static SparkJobResponse toJobResponse(@Nonnull final String id, @Nonnull final Statement statement) {
final SparkJobResponse response = new SparkJobResponse();
response.setId(id);
response.setStatus(StatementStateTranslator.translate(statement.getState()));
if (response.getStatus() == TransformResponse.Status.SUCCESS) {
final JsonNode data = statement.getOutput().getData();
if (data != null) {
final String json = data.get("application/json").asText();
response.setResult(ObjectMapperSerializer.deserialize(json, SparkJobResult.class));
}
}
return response;
}
Aggregations