@RestController
@RequestMapping(value="/api/v3/jobs")
public class JobRestController
extends java.lang.Object
Constructor and Description |
---|
JobRestController(JobLaunchService jobLaunchService,
JobSearchService jobSearchService,
JobCoordinatorService jobCoordinatorService,
ResourceAssemblers resourceAssemblers,
GenieHostInfo genieHostInfo,
org.springframework.web.client.RestTemplate restTemplate,
JobDirectoryServerService jobDirectoryServerService,
JobsProperties jobsProperties,
io.micrometer.core.instrument.MeterRegistry registry,
JobPersistenceService jobPersistenceService,
AgentRoutingService agentRoutingService,
org.springframework.core.env.Environment environment,
AttachmentService attachmentService)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.springframework.hateoas.PagedResources<JobSearchResultResource> |
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.
|
JobResource |
getJob(java.lang.String id)
Get job information for given job id.
|
java.util.List<ApplicationResource> |
getJobApplications(java.lang.String id)
Get the applications used ot run the job.
|
ClusterResource |
getJobCluster(java.lang.String id)
Get the cluster the job was run on or is currently running on.
|
CommandResource |
getJobCommand(java.lang.String id)
Get the command the job was run with or is currently running with.
|
JobExecutionResource |
getJobExecution(java.lang.String id)
Get the execution information about a job.
|
JobMetadataResource |
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.
|
JobRequestResource |
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, JobSearchService jobSearchService, JobCoordinatorService jobCoordinatorService, ResourceAssemblers resourceAssemblers, GenieHostInfo genieHostInfo, @Qualifier(value="genieRestTemplate") org.springframework.web.client.RestTemplate restTemplate, JobDirectoryServerService jobDirectoryServerService, JobsProperties jobsProperties, io.micrometer.core.instrument.MeterRegistry registry, JobPersistenceService jobPersistenceService, AgentRoutingService agentRoutingService, org.springframework.core.env.Environment environment, AttachmentService attachmentService)
jobLaunchService
- The JobLaunchService
implementation to usejobSearchService
- The search service to usejobCoordinatorService
- The job coordinator service to use.resourceAssemblers
- 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 usejobPersistenceService
- Job persistence serviceagentRoutingService
- Agent routing serviceenvironment
- The application environment to pull dynamic properties fromattachmentService
- The attachment service to use to save attachments.@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 JobResource 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 GenieException
id
- The id of the job to get status forJobStatus
GenieException
- on error@GetMapping(produces="application/hal+json") @ResponseStatus(value=OK) public org.springframework.hateoas.PagedResources<JobSearchResultResource> 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, 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 errorjava.io.IOException
- on redirect error@GetMapping(value="/{id}/request", produces="application/hal+json") @ResponseStatus(value=OK) public JobRequestResource 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 JobExecutionResource 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 JobMetadataResource 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 ClusterResource getJobCluster(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the job to get the cluster forGenieException
- Usually GenieNotFound exception when either the job or the cluster aren't found@GetMapping(value="/{id}/command", produces="application/hal+json") @ResponseStatus(value=OK) public CommandResource getJobCommand(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the job to get the command forGenieException
- Usually GenieNotFound exception 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<ApplicationResource> getJobApplications(@PathVariable(value="id") java.lang.String id) throws GenieException
id
- The id of the job to get the applications forGenieException
- Usually GenieNotFound exception when either the job or the applications aren't found@GetMapping(value={"/{id}/output","/{id}/output/","/{id}/output/**"}, produces="*/*") 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 java.io.IOException, javax.servlet.ServletException, GenieException
id
- The id of the job to get output forforwardedFrom
- The host this request was forwarded from if presentrequest
- the servlet requestresponse
- the servlet responsejava.io.IOException
- on redirect errorjavax.servlet.ServletException
- when trying to handle the requestGenieException
- on any Genie internal error