@RestController
@RequestMapping(value="/api/v3/jobs")
public class JobRestController
extends java.lang.Object
Constructor and Description |
---|
JobRestController(JobLaunchService jobLaunchService,
DataServices dataServices,
JobCoordinatorService jobCoordinatorService,
EntityModelAssemblers entityModelAssemblers,
GenieHostInfo genieHostInfo,
org.springframework.web.client.RestTemplate restTemplate,
JobDirectoryServerService jobDirectoryServerService,
JobsProperties jobsProperties,
io.micrometer.core.instrument.MeterRegistry registry,
AgentRoutingService agentRoutingService,
org.springframework.core.env.Environment environment,
AttachmentService attachmentService,
JobExecutionModeSelector jobExecutionModeSelector)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<JobSearchResult>> |
findJobs(java.lang.String id,
java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String clusterName,
java.lang.String clusterId,
java.lang.String commandName,
java.lang.String commandId,
java.lang.Long minStarted,
java.lang.Long maxStarted,
java.lang.Long minFinished,
java.lang.Long maxFinished,
java.lang.String grouping,
java.lang.String groupingInstance,
org.springframework.data.domain.Pageable page,
org.springframework.data.web.PagedResourcesAssembler<JobSearchResult> assembler)
Get jobs for given filter criteria.
|
org.springframework.hateoas.EntityModel<Job> |
getJob(java.lang.String id)
Get job information for given job id.
|
java.util.List<org.springframework.hateoas.EntityModel<Application>> |
getJobApplications(java.lang.String id)
Get the applications used ot run the job.
|
org.springframework.hateoas.EntityModel<Cluster> |
getJobCluster(java.lang.String id)
Get the cluster the job was run on or is currently running on.
|
org.springframework.hateoas.EntityModel<Command> |
getJobCommand(java.lang.String id)
Get the command the job was run with or is currently running with.
|
org.springframework.hateoas.EntityModel<JobExecution> |
getJobExecution(java.lang.String id)
Get the execution information about a job.
|
org.springframework.hateoas.EntityModel<JobMetadata> |
getJobMetadata(java.lang.String id)
Get the metadata information about a job.
|
void |
getJobOutput(java.lang.String id,
java.lang.String forwardedFrom,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Get the job output directory.
|
org.springframework.hateoas.EntityModel<JobRequest> |
getJobRequest(java.lang.String id)
Get the original job request.
|
com.fasterxml.jackson.databind.JsonNode |
getJobStatus(java.lang.String id)
Get the status of the given job if it exists.
|
void |
killJob(java.lang.String id,
java.lang.String forwardedFrom,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Kill job based on given job ID.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
submitJob(@Valid JobRequest jobRequest,
org.springframework.web.multipart.MultipartFile[] attachments,
java.lang.String clientHost,
java.lang.String userAgent,
javax.servlet.http.HttpServletRequest httpServletRequest)
Submit a new job with attachments.
|
org.springframework.http.ResponseEntity<java.lang.Void> |
submitJob(@Valid JobRequest jobRequest,
java.lang.String clientHost,
java.lang.String userAgent,
javax.servlet.http.HttpServletRequest httpServletRequest)
Submit a new job.
|
@Autowired public JobRestController(JobLaunchService jobLaunchService, DataServices dataServices, JobCoordinatorService jobCoordinatorService, EntityModelAssemblers entityModelAssemblers, GenieHostInfo genieHostInfo, @Qualifier(value="genieRestTemplate") org.springframework.web.client.RestTemplate restTemplate, JobDirectoryServerService jobDirectoryServerService, JobsProperties jobsProperties, io.micrometer.core.instrument.MeterRegistry registry, AgentRoutingService agentRoutingService, org.springframework.core.env.Environment environment, AttachmentService attachmentService, JobExecutionModeSelector jobExecutionModeSelector)
jobLaunchService
- The JobLaunchService
implementation to usedataServices
- The DataServices
instance to usejobCoordinatorService
- The job coordinator service to use.entityModelAssemblers
- The encapsulation of all the V3 resource assemblersgenieHostInfo
- Information about the host that the Genie process is running onrestTemplate
- The rest template for http requestsjobDirectoryServerService
- The service to handle serving back job directory resourcesjobsProperties
- All the properties associated with jobsregistry
- The metrics registry to useagentRoutingService
- Agent routing serviceenvironment
- The application environment to pull dynamic properties fromattachmentService
- The attachment service to use to save attachments.jobExecutionModeSelector
- The execution mode (agent vs. embedded) mode selector@PostMapping(consumes="application/json") @ResponseStatus(value=ACCEPTED) public org.springframework.http.ResponseEntity<java.lang.Void> submitJob(@Valid @RequestBody @Valid JobRequest jobRequest, @RequestHeader(value="X-Forwarded-For",required=false) @Nullable java.lang.String clientHost, @RequestHeader(value="User-Agent",required=false) @Nullable java.lang.String userAgent, javax.servlet.http.HttpServletRequest httpServletRequest) throws GenieException, GenieCheckedException
jobRequest
- The job request informationclientHost
- client host sending the requestuserAgent
- The user agent stringhttpServletRequest
- The http servlet requestGenieException
- For any errorGenieCheckedException
- For V4 Agent Execution errors@PostMapping(consumes="multipart/form-data") @ResponseStatus(value=ACCEPTED) public org.springframework.http.ResponseEntity<java.lang.Void> submitJob(@Valid @RequestPart(value="request") @Valid JobRequest jobRequest, @RequestPart(value="attachment") org.springframework.web.multipart.MultipartFile[] attachments, @RequestHeader(value="X-Forwarded-For",required=false) @Nullable java.lang.String clientHost, @RequestHeader(value="User-Agent",required=false) @Nullable java.lang.String userAgent, javax.servlet.http.HttpServletRequest httpServletRequest) throws GenieException, GenieCheckedException
jobRequest
- The job request informationattachments
- The attachments for the jobclientHost
- client host sending the requestuserAgent
- The user agent stringhttpServletRequest
- The http servlet requestGenieException
- For any errorGenieCheckedException
- For V4 Agent Execution errors@GetMapping(value="/{id}", produces="application/hal+json") public org.springframework.hateoas.EntityModel<Job> getJob(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- id for job to look upGenieException
- For any error@GetMapping(value="/{id}/status", produces="application/json") public com.fasterxml.jackson.databind.JsonNode getJobStatus(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the job to get status forJobStatus
NotFoundException
- When no job with id exists@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<JobSearchResult>> findJobs(@RequestParam(value="id",required=false) @Nullable java.lang.String id, @RequestParam(value="name",required=false) @Nullable java.lang.String name, @RequestParam(value="user",required=false) @Nullable java.lang.String user, @RequestParam(value="status",required=false) @Nullable java.util.Set<java.lang.String> statuses, @RequestParam(value="tag",required=false) @Nullable java.util.Set<java.lang.String> tags, @RequestParam(value="clusterName",required=false) @Nullable java.lang.String clusterName, @RequestParam(value="clusterId",required=false) @Nullable java.lang.String clusterId, @RequestParam(value="commandName",required=false) @Nullable java.lang.String commandName, @RequestParam(value="commandId",required=false) @Nullable java.lang.String commandId, @RequestParam(value="minStarted",required=false) @Nullable java.lang.Long minStarted, @RequestParam(value="maxStarted",required=false) @Nullable java.lang.Long maxStarted, @RequestParam(value="minFinished",required=false) @Nullable java.lang.Long minFinished, @RequestParam(value="maxFinished",required=false) @Nullable java.lang.Long maxFinished, @RequestParam(value="grouping",required=false) @Nullable java.lang.String grouping, @RequestParam(value="groupingInstance",required=false) @Nullable java.lang.String groupingInstance, @PageableDefault(sort="created",direction=DESC) org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler<JobSearchResult> assembler) throws GenieException
id
- id for jobname
- name of job (can be a SQL-style pattern such as HIVE%)user
- user who submitted jobstatuses
- statuses of jobs to findtags
- tags for the jobclusterName
- the name of the clusterclusterId
- the id of the clustercommandName
- the name of the command run by the jobcommandId
- the id of the command run by the jobminStarted
- The time which the job had to start after in order to be return (inclusive)maxStarted
- The time which the job had to start before in order to be returned (exclusive)minFinished
- The time which the job had to finish after in order to be return (inclusive)maxFinished
- The time which the job had to finish before in order to be returned (exclusive)grouping
- The grouping the job should be a member ofgroupingInstance
- The grouping instance the job should be a member ofpage
- page information for jobassembler
- The paged resources assembler to useGenieException
- For any error@DeleteMapping(value="/{id}") @ResponseStatus(value=ACCEPTED) public void killJob(@PathVariable(value="id") java.lang.String id, @RequestHeader(name="Genie-Forwarded-From",required=false) @Nullable java.lang.String forwardedFrom, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws GenieException, NotFoundException, java.io.IOException
id
- id for job to killforwardedFrom
- The host this request was forwarded from if presentrequest
- the servlet requestresponse
- the servlet responseGenieException
- For any errorNotFoundException
- When no job with id existsjava.io.IOException
- on redirect error@GetMapping(value="/{id}/request", produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.EntityModel<JobRequest> getJobRequest(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the jobGenieException
- On any internal error@GetMapping(value="/{id}/execution", produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.EntityModel<JobExecution> getJobExecution(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the jobGenieException
- On any internal error@GetMapping(value="/{id}/metadata", produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.EntityModel<JobMetadata> getJobMetadata(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the jobGenieException
- On any internal error@GetMapping(value="/{id}/cluster", produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.EntityModel<Cluster> getJobCluster(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the job to get the cluster forNotFoundException
- When either the job or the cluster aren't found@GetMapping(value="/{id}/command", produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.EntityModel<Command> getJobCommand(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the job to get the command forNotFoundException
- When either the job or the command aren't found@GetMapping(value="/{id}/applications", produces="application/hal+json") @ResponseStatus(value=OK) public java.util.List<org.springframework.hateoas.EntityModel<Application>> getJobApplications(@PathVariable(value="id") java.lang.String id) throws NotFoundException
id
- The id of the job to get the applications forNotFoundException
- When either the job or the applications aren't found@GetMapping(value={"/{id}/output","/{id}/output/","/{id}/output/**"}) public void getJobOutput(@PathVariable(value="id") java.lang.String id, @RequestHeader(name="Genie-Forwarded-From",required=false) @Nullable java.lang.String forwardedFrom, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws GenieException, NotFoundException
id
- The id of the job to get output forforwardedFrom
- The host this request was forwarded from if presentrequest
- the servlet requestresponse
- the servlet responseNotFoundException
- When no job with id existsGenieException
- on any Genie internal error