use of com.thinkbiganalytics.kylo.spark.job.SparkJobContext in project kylo by Teradata.
the class SparkShellProxyController method getJobResult.
@GET
@Path("/job/{job}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Fetches the status of a job")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the status of the job.", response = SparkJobResponse.class), @ApiResponse(code = 404, message = "The job does not exist.", response = RestResponseStatus.class), @ApiResponse(code = 500, message = "There was a problem accessing the data.", response = SparkJobResponse.class) })
public void getJobResult(@Nonnull @PathParam("job") final String jobId, @Suspended final AsyncResponse response) {
final SparkJobContext context = sparkJobService.findById(jobId).orElseThrow(NotFoundException::new);
context.subscribe(jobSubscriber(context, response));
}
use of com.thinkbiganalytics.kylo.spark.job.SparkJobContext in project kylo by Teradata.
the class SparkShellProxyController method createJob.
@POST
@Path("/job")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Submits a Spark job to be executed.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the status of the job.", response = SparkJobResponse.class), @ApiResponse(code = 400, message = "The requested job does not exist.", response = RestResponseStatus.class), @ApiResponse(code = 500, message = "There was a problem processing the job.", response = SparkJobResponse.class) })
public void createJob(final SparkJobRequest request, @Suspended final AsyncResponse response) {
// Validate request
if (request == null || request.getScript() == null) {
throw transformError(Response.Status.BAD_REQUEST, "job.missing-script", null);
}
// Execute request
final SparkJobContext context = sparkJobService.create(request);
context.subscribe(jobSubscriber(context, response));
}
Aggregations