Interface AgentJobService


@Validated public interface AgentJobService
Agent side job specification service for resolving and retrieving job specifications from the server.
Since:
4.0.0
  • Method Details

    • handshake

      void handshake(@Valid @Valid AgentClientMetadata agentClientMetadata) throws HandshakeException
      Perform 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

      Map<String,String> configure(@Valid @Valid AgentClientMetadata agentClientMetadata) throws ConfigureException
      Obtain 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

      String reserveJobId(@Valid @Valid AgentJobRequest jobRequest, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationException, JobIdUnavailableException
      Request 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 metadata
      agentClientMetadata - 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 request
      JobIdUnavailableException - if the id requested has already been used
    • resolveJobSpecification

      JobSpecification resolveJobSpecification(@NotBlank @NotBlank 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 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 String jobId, @Valid @Valid AgentClientMetadata agentClientMetadata) throws JobReservationException
      Claim a given job, telling the server that this agent is about to begin execution.
      Parameters:
      jobId - the id of the job
      agentClientMetadata - 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 String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, String message) throws ChangeJobStatusException
      Notify the server of a change of job status.
      Parameters:
      jobId - the id of the job
      currentJobStatus - the expected current status of the job
      newJobStatus - the new status of the job
      message - 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 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 String jobId, ArchiveStatus archiveStatus) throws ChangeJobArchiveStatusException
      Notify the server of a change of job files archive status.
      Parameters:
      jobId - the id of the job
      archiveStatus - the new archive status of the job
      Throws:
      ChangeJobArchiveStatusException - when the agent fails to update the job archive status