@RestController
@RequestMapping(value="/api/v3/jobs")
public class JobRestController
extends java.lang.Object
| Constructor and Description |
|---|
JobRestController(JobCoordinatorService jobCoordinatorService,
JobSearchService jobSearchService,
AttachmentService attachmentService,
ApplicationResourceAssembler applicationResourceAssembler,
ClusterResourceAssembler clusterResourceAssembler,
CommandResourceAssembler commandResourceAssembler,
JobResourceAssembler jobResourceAssembler,
JobRequestResourceAssembler jobRequestResourceAssembler,
JobExecutionResourceAssembler jobExecutionResourceAssembler,
JobMetadataResourceAssembler jobMetadataResourceAssembler,
JobSearchResultResourceAssembler jobSearchResultResourceAssembler,
com.netflix.genie.common.internal.util.GenieHostInfo genieHostInfo,
org.springframework.web.client.RestTemplate restTemplate,
JobDirectoryServerService jobDirectoryServerService,
JobsProperties jobsProperties,
io.micrometer.core.instrument.MeterRegistry registry,
JobPersistenceService jobPersistenceService,
AgentRoutingService agentRoutingService)
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<com.netflix.genie.common.dto.search.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 com.netflix.genie.common.dto.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 com.netflix.genie.common.dto.JobRequest jobRequest,
java.lang.String clientHost,
java.lang.String userAgent,
javax.servlet.http.HttpServletRequest httpServletRequest)
Submit a new job.
|
@Autowired public JobRestController(JobCoordinatorService jobCoordinatorService, JobSearchService jobSearchService, AttachmentService attachmentService, ApplicationResourceAssembler applicationResourceAssembler, ClusterResourceAssembler clusterResourceAssembler, CommandResourceAssembler commandResourceAssembler, JobResourceAssembler jobResourceAssembler, JobRequestResourceAssembler jobRequestResourceAssembler, JobExecutionResourceAssembler jobExecutionResourceAssembler, JobMetadataResourceAssembler jobMetadataResourceAssembler, JobSearchResultResourceAssembler jobSearchResultResourceAssembler, com.netflix.genie.common.internal.util.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)
jobCoordinatorService - The job coordinator service to use.jobSearchService - The search service to useattachmentService - The attachment service to use to save attachments.applicationResourceAssembler - Assemble application resources out of applicationsclusterResourceAssembler - Assemble cluster resources out of applicationscommandResourceAssembler - Assemble cluster resources out of applicationsjobResourceAssembler - Assemble job resources out of jobsjobRequestResourceAssembler - Assemble job request resources out of job requestsjobExecutionResourceAssembler - Assemble job execution resources out of job executionsjobMetadataResourceAssembler - Assemble job metadata resources out of job metadata DTOjobSearchResultResourceAssembler - Assemble job search resources out of jobsgenieHostInfo - 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 service@PostMapping(consumes="application/json")
@ResponseStatus(value=ACCEPTED)
public org.springframework.http.ResponseEntity<java.lang.Void> submitJob(@Valid @RequestBody
@Valid com.netflix.genie.common.dto.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 com.netflix.genie.common.exceptions.GenieException
jobRequest - The job request informationclientHost - client host sending the requestuserAgent - The user agent stringhttpServletRequest - The http servlet requestcom.netflix.genie.common.exceptions.GenieException - For any error@PostMapping(consumes="multipart/form-data")
@ResponseStatus(value=ACCEPTED)
public org.springframework.http.ResponseEntity<java.lang.Void> submitJob(@Valid @RequestPart(value="request")
@Valid com.netflix.genie.common.dto.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 com.netflix.genie.common.exceptions.GenieException
jobRequest - The job request informationattachments - The attachments for the jobclientHost - client host sending the requestuserAgent - The user agent stringhttpServletRequest - The http servlet requestcom.netflix.genie.common.exceptions.GenieException - For any error@GetMapping(value="/{id}",
produces="application/hal+json")
public JobResource getJob(@PathVariable(value="id")
java.lang.String id)
throws com.netflix.genie.common.exceptions.GenieException
id - id for job to look upcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the job to get status forJobStatuscom.netflix.genie.common.exceptions.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<com.netflix.genie.common.dto.search.JobSearchResult> assembler) throws com.netflix.genie.common.exceptions.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 usecom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException,
java.io.IOException
id - id for job to killforwardedFrom - The host this request was forwarded from if presentrequest - the servlet requestresponse - the servlet responsecom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the jobcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the jobcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the jobcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the job to get the cluster forcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the job to get the command forcom.netflix.genie.common.exceptions.GenieException - 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 com.netflix.genie.common.exceptions.GenieException
id - The id of the job to get the applications forcom.netflix.genie.common.exceptions.GenieException - 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,
com.netflix.genie.common.exceptions.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 requestcom.netflix.genie.common.exceptions.GenieException - on any Genie internal error