@RestController
@RequestMapping(value="/api/v3/jobs")
public class JobRestController
extends java.lang.Object
| Constructor and Description |
|---|
JobRestController(JobLaunchService jobLaunchService,
DataServices dataServices,
EntityModelAssemblers entityModelAssemblers,
com.netflix.genie.common.internal.util.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,
JobKillService jobKillService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.search.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<com.netflix.genie.common.dto.search.JobSearchResult> assembler)
Get jobs for given filter criteria.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Job> |
getJob(java.lang.String id)
Get job information for given job id.
|
java.util.List<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Application>> |
getJobApplications(java.lang.String id)
Get the applications used ot run the job.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Cluster> |
getJobCluster(java.lang.String id)
Get the cluster the job was run on or is currently running on.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Command> |
getJobCommand(java.lang.String id)
Get the command the job was run with or is currently running with.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.JobExecution> |
getJobExecution(java.lang.String id)
Get the execution information about a job.
|
org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.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<com.netflix.genie.common.dto.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 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(JobLaunchService jobLaunchService, DataServices dataServices, EntityModelAssemblers entityModelAssemblers, 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, AgentRoutingService agentRoutingService, org.springframework.core.env.Environment environment, AttachmentService attachmentService, JobKillService jobKillService)
jobLaunchService - The JobLaunchService implementation to usedataServices - The DataServices instance to useentityModelAssemblers - 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.jobKillService - The service to kill running jobs@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,
com.netflix.genie.common.internal.exceptions.checked.GenieCheckedException
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 errorcom.netflix.genie.common.internal.exceptions.checked.GenieCheckedException - 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 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,
com.netflix.genie.common.internal.exceptions.checked.GenieCheckedException
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 errorcom.netflix.genie.common.internal.exceptions.checked.GenieCheckedException - For V4 Agent Execution errors@GetMapping(value="/{id}",
produces="application/hal+json")
public org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.Job> 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 NotFoundException
id - The id of the job to get status forJobStatusNotFoundException - When no job with id exists@GetMapping(produces="application/hal+json")
@ResponseStatus(value=OK)
public org.springframework.hateoas.PagedModel<org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.search.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<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,
NotFoundException,
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 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<com.netflix.genie.common.dto.JobRequest> 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 org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.JobExecution> 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 org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.JobMetadata> 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 org.springframework.hateoas.EntityModel<com.netflix.genie.common.dto.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<com.netflix.genie.common.dto.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<com.netflix.genie.common.dto.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 com.netflix.genie.common.exceptions.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 existscom.netflix.genie.common.exceptions.GenieException - on any Genie internal error