@Validated
public interface AgentJobService
Modifier and Type | Method and Description |
---|---|
void |
claimJob(@NotBlank java.lang.String id,
@Valid AgentClientMetadata agentClientMetadata)
Set a job identified by
id to be owned by the agent identified by agentClientMetadata . |
JobSpecification |
dryRunJobSpecificationResolution(@Valid JobRequest jobRequest)
Run the job specification resolution algorithm on the given input but save nothing in the system.
|
JobSpecification |
getJobSpecification(@NotBlank java.lang.String id)
Get a job specification if has been resolved.
|
void |
handshake(@Valid AgentClientMetadata agentMetadata)
Shake hands and allow a client or reject it based on the supplied
AgentClientMetadata . |
java.lang.String |
reserveJobId(@Valid JobRequest jobRequest,
@Valid AgentClientMetadata agentClientMetadata)
Reserve a job id and persist job details in the database based on the supplied
JobRequest . |
JobSpecification |
resolveJobSpecification(@NotBlank java.lang.String id)
Resolve the job specification for job identified by the given id.
|
void |
updateJobStatus(@NotBlank java.lang.String id,
JobStatus currentStatus,
JobStatus newStatus,
java.lang.String newStatusMessage)
Update the status of the job identified with
id to be newStatus provided that the current status
of the job matches newStatus . |
void handshake(@Valid @Valid AgentClientMetadata agentMetadata)
AgentClientMetadata
.agentMetadata
- The metadata about the agent starting to run a given jobGenieAgentRejectedException
- If the server rejects the client based on its metadatajavax.validation.ConstraintViolationException
- If the arguments fail validationjava.lang.String reserveJobId(@Valid @Valid JobRequest jobRequest, @Valid @Valid AgentClientMetadata agentClientMetadata)
JobRequest
.jobRequest
- The job request containing all the metadata needed to reserve a job idagentClientMetadata
- The metadata about the agent driving this job requestGenieIdAlreadyExistsException
- If the id requested along with the job request is already in usejavax.validation.ConstraintViolationException
- If the arguments fail validationJobSpecification resolveJobSpecification(@NotBlank @NotBlank java.lang.String id)
id
- The id of the job to resolve the specification for. Must already have a reserved an id in the databaseGenieJobNotFoundException
- If the job has not yet had its ID reserved and/or can't be foundGenieClusterNotFoundException
- When the cluster specified in the job specification doesn't actually
existGenieCommandNotFoundException
- When the command specified in the job specification doesn't actually
existGenieApplicationNotFoundException
- When an application specified in the job specification doesn't
actually existjavax.validation.ConstraintViolationException
- If the arguments fail validationJobSpecification getJobSpecification(@NotBlank @NotBlank java.lang.String id)
id
- the id of the job to retrieve the specification forGenieJobNotFoundException
- If the job has not yet had its ID reserved and/or can't be foundGenieJobSpecificationNotFoundException
- If the job exists but the specification hasn't been
resolved or saved yetjavax.validation.ConstraintViolationException
- If the arguments fail validationJobSpecification dryRunJobSpecificationResolution(@Valid @Valid JobRequest jobRequest)
jobRequest
- The job request containing all the metadata needed to resolve a job specificationjavax.validation.ConstraintViolationException
- If the arguments fail validationvoid claimJob(@NotBlank @NotBlank java.lang.String id, @Valid @Valid AgentClientMetadata agentClientMetadata)
id
to be owned by the agent identified by agentClientMetadata
. The
job status in the system will be set to JobStatus.CLAIMED
id
- The id of the job to claim. Must exist in the system.agentClientMetadata
- The metadata about the client claiming the jobGenieJobNotFoundException
- if no job with the given id
existsGenieJobAlreadyClaimedException
- if the job with the given id
already has been claimedGenieInvalidStatusException
- if the current job status is not
JobStatus.RESOLVED
javax.validation.ConstraintViolationException
- If the arguments fail validationvoid updateJobStatus(@NotBlank @NotBlank java.lang.String id, JobStatus currentStatus, JobStatus newStatus, @Nullable java.lang.String newStatusMessage)
id
to be newStatus
provided that the current status
of the job matches newStatus
. Optionally a status message can be provided to provide more details to
users. If the newStatus
is JobStatus.RUNNING
the start time will be set. If the newStatus
is a member of JobStatus.getFinishedStatuses()
and the job had a started time set the finished time of
the job will be set.id
- The id of the job to update status for. Must exist in the system.currentStatus
- The status the caller to this API thinks the job currently hasnewStatus
- The new status the caller would like to update the status tonewStatusMessage
- An optional status message to associate with this changeGenieJobNotFoundException
- if no job with the given id
existsGenieInvalidStatusException
- if the current status of the job identified by id
in the system
doesn't match the supplied currentStatus
.
Also if the currentStatus
equals the newStatus
.javax.validation.ConstraintViolationException
- If the arguments fail validation