Interface AgentJobService
-
@Validated public interface AgentJobServiceAgent side job specification service for resolving and retrieving job specifications from the server.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidchangeJobArchiveStatus(@NotBlank java.lang.String jobId, ArchiveStatus archiveStatus)Notify the server of a change of job files archive status.voidchangeJobStatus(@NotBlank java.lang.String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, java.lang.String message)Notify the server of a change of job status.voidclaimJob(@NotBlank java.lang.String jobId, @Valid AgentClientMetadata agentClientMetadata)Claim a given job, telling the server that this agent is about to begin execution.java.util.Map<java.lang.String,java.lang.String>configure(@Valid AgentClientMetadata agentClientMetadata)Obtain server-provided configuration properties.JobSpecificationgetJobSpecification(@NotBlank java.lang.String id)Given a job id retrieve the job specification from the server.JobStatusgetJobStatus(@NotBlank java.lang.String jobId)Retrieve the current job status for the given job id.voidhandshake(@Valid AgentClientMetadata agentClientMetadata)Perform server handshake.java.lang.StringreserveJobId(@Valid AgentJobRequest jobRequest, @Valid AgentClientMetadata agentClientMetadata)Request a given job id to be reserved for this job, send along the job details, to be persisted by the server.JobSpecificationresolveJobSpecification(@NotBlank java.lang.String id)Given the parameters supplied by the job request attempt to resolve a job specification on the server.JobSpecificationresolveJobSpecificationDryRun(@Valid AgentJobRequest jobRequest)Invoke the job specification resolution logic without persisting anything on the server.
-
-
-
Method Detail
-
handshake
void handshake(@Valid @Valid AgentClientMetadata agentClientMetadata) throws HandshakeExceptionPerform server handshake. Before going any further, ensure the server is reachable and that this agent is compatible with it.- Parameters:
agentClientMetadata- metadata about the client making this request- Throws:
HandshakeException- if the server rejects this client
-
configure
java.util.Map<java.lang.String,java.lang.String> configure(@Valid @Valid AgentClientMetadata agentClientMetadata) throws ConfigureExceptionObtain server-provided configuration properties.- Parameters:
agentClientMetadata- metadata about the client making this request- Returns:
- a map of properties
- Throws:
ConfigureException- if the server properties cannot be obtained
-
reserveJobId
java.lang.String reserveJobId(@Valid @Valid AgentJobRequest jobRequest, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationException, JobIdUnavailableExceptionRequest a given job id to be reserved for this job, send along the job details, to be persisted by the server. The request may or may not contain a job id.- Parameters:
jobRequest- the job parameters and agent metadataagentClientMetadata- metadata about the client making this request- Returns:
- the job id assigned by the server (matches the one in the request, if one was present)
- Throws:
JobReservationException- if the server failed to fulfill this requestJobIdUnavailableException- if the id requested has already been used
-
resolveJobSpecification
JobSpecification resolveJobSpecification(@NotBlank @NotBlank java.lang.String id) throws JobSpecificationResolutionException
Given the parameters supplied by the job request attempt to resolve a job specification on the server.- Parameters:
id- The id of the job to resolve a job specification for- Returns:
- The job specification
- Throws:
JobSpecificationResolutionException- if the specification cannot be resolved
-
getJobSpecification
JobSpecification getJobSpecification(@NotBlank @NotBlank java.lang.String id) throws JobSpecificationResolutionException
Given a job id retrieve the job specification from the server.- Parameters:
id- The id of the job to get the specification for- Returns:
- The job specification
- Throws:
JobSpecificationResolutionException- if the specification cannot be retrieved
-
resolveJobSpecificationDryRun
JobSpecification resolveJobSpecificationDryRun(@Valid @Valid AgentJobRequest jobRequest) throws JobSpecificationResolutionException
Invoke the job specification resolution logic without persisting anything on the server.- Parameters:
jobRequest- The various parameters required to perform the dry run should be contained in this request- Returns:
- The job specification
- Throws:
JobSpecificationResolutionException- When an error occurred during attempted resolution
-
claimJob
void claimJob(@NotBlank @NotBlank java.lang.String jobId, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationExceptionClaim a given job, telling the server that this agent is about to begin execution.- Parameters:
jobId- the id of the jobagentClientMetadata- metadata for the agent claiming this job- Throws:
JobReservationException- When the the claim request fails is invalid (reasons include: job already claimed, invalid job ID, failure to reach the server
-
changeJobStatus
void changeJobStatus(@NotBlank @NotBlank java.lang.String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, java.lang.String message) throws ChangeJobStatusExceptionNotify the server of a change of job status.- Parameters:
jobId- the id of the jobcurrentJobStatus- the expected current status of the jobnewJobStatus- the new status of the jobmessage- an optional message tha accompanies this change of status- Throws:
ChangeJobStatusException- when the agent fails to update the job status
-
getJobStatus
JobStatus getJobStatus(@NotBlank @NotBlank java.lang.String jobId) throws GetJobStatusException
Retrieve the current job status for the given job id.- Parameters:
jobId- the id of the job- Returns:
- the job status seen by the server
- Throws:
GetJobStatusException- when the agent fails to retrieve the job status
-
changeJobArchiveStatus
void changeJobArchiveStatus(@NotBlank @NotBlank java.lang.String jobId, ArchiveStatus archiveStatus) throws ChangeJobArchiveStatusExceptionNotify the server of a change of job files archive status.- Parameters:
jobId- the id of the jobarchiveStatus- the new archive status of the job- Throws:
ChangeJobArchiveStatusException- when the agent fails to update the job archive status
-
-