@Validated @Transactional public class AgentJobServiceImpl extends java.lang.Object implements AgentJobService
AgentJobService.| Constructor and Description |
|---|
AgentJobServiceImpl(DataServices dataServices,
JobResolverService jobResolverService,
AgentFilterService agentFilterService,
AgentConfigurationService agentConfigurationService,
io.micrometer.core.instrument.MeterRegistry meterRegistry)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
claimJob(@NotBlank java.lang.String id,
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
Set a job identified by
id to be owned by the agent identified by agentClientMetadata. |
com.netflix.genie.common.external.dtos.v4.JobSpecification |
dryRunJobSpecificationResolution(@Valid com.netflix.genie.common.external.dtos.v4.JobRequest jobRequest)
Run the job specification resolution algorithm on the given input but save nothing in the system.
|
java.util.Map<java.lang.String,java.lang.String> |
getAgentProperties(@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
Provide configuration properties for an agent that is beginning to execute a job.
|
com.netflix.genie.common.external.dtos.v4.JobSpecification |
getJobSpecification(@NotBlank java.lang.String id)
Get a job specification if has been resolved.
|
com.netflix.genie.common.external.dtos.v4.JobStatus |
getJobStatus(@NotBlank java.lang.String id)
Retrieve the status of the job identified with
id. |
void |
handshake(@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
Shake hands and allow a client or reject it based on the supplied
AgentClientMetadata. |
java.lang.String |
reserveJobId(@Valid com.netflix.genie.common.external.dtos.v4.JobRequest jobRequest,
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
Reserve a job id and persist job details in the database based on the supplied
JobRequest. |
com.netflix.genie.common.external.dtos.v4.JobSpecification |
resolveJobSpecification(@NotBlank java.lang.String id)
Resolve the job specification for job identified by the given id.
|
void |
updateJobArchiveStatus(@NotBlank java.lang.String id,
com.netflix.genie.common.external.dtos.v4.ArchiveStatus newArchiveStatus)
Update the archive status status of the job identified with
id to be newStatus. |
void |
updateJobStatus(@NotBlank java.lang.String id,
com.netflix.genie.common.external.dtos.v4.JobStatus currentStatus,
com.netflix.genie.common.external.dtos.v4.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. |
public AgentJobServiceImpl(DataServices dataServices, JobResolverService jobResolverService, AgentFilterService agentFilterService, AgentConfigurationService agentConfigurationService, io.micrometer.core.instrument.MeterRegistry meterRegistry)
dataServices - The DataServices instance to usejobResolverService - The specification service to useagentFilterService - The agent filter service to useagentConfigurationService - The agent configuration servicemeterRegistry - The metrics registry to usepublic void handshake(@Valid
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
throws com.netflix.genie.common.internal.exceptions.unchecked.GenieAgentRejectedException
AgentClientMetadata.handshake in interface AgentJobServiceagentClientMetadata - The metadata about the agent starting to run a given jobcom.netflix.genie.common.internal.exceptions.unchecked.GenieAgentRejectedException - If the server rejects the client based on its metadatapublic java.util.Map<java.lang.String,java.lang.String> getAgentProperties(@Valid
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
getAgentProperties in interface AgentJobServiceagentClientMetadata - The metadata about the agent starting to run a given jobpublic java.lang.String reserveJobId(@Valid
@Valid com.netflix.genie.common.external.dtos.v4.JobRequest jobRequest,
@Valid
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
JobRequest.reserveJobId in interface AgentJobServicejobRequest - The job request containing all the metadata needed to reserve a job idagentClientMetadata - The metadata about the agent driving this job requestpublic com.netflix.genie.common.external.dtos.v4.JobSpecification resolveJobSpecification(@NotBlank
@NotBlank java.lang.String id)
throws com.netflix.genie.common.internal.exceptions.checked.GenieJobResolutionException,
com.netflix.genie.common.internal.exceptions.unchecked.GenieJobResolutionRuntimeException
resolveJobSpecification in interface AgentJobServiceid - The id of the job to resolve the specification for. Must already have a reserved an id in the databasecom.netflix.genie.common.internal.exceptions.checked.GenieJobResolutionException - On error resolving the job given the input parameters and system statecom.netflix.genie.common.internal.exceptions.unchecked.GenieJobResolutionRuntimeException - If job resolution fails due to a runtime error (as opposed to
unsatisfiable constraints)@Transactional(readOnly=true)
public com.netflix.genie.common.external.dtos.v4.JobSpecification getJobSpecification(@NotBlank
@NotBlank java.lang.String id)
getJobSpecification in interface AgentJobServiceid - the id of the job to retrieve the specification for@Transactional(readOnly=true)
public com.netflix.genie.common.external.dtos.v4.JobSpecification dryRunJobSpecificationResolution(@Valid
@Valid com.netflix.genie.common.external.dtos.v4.JobRequest jobRequest)
throws com.netflix.genie.common.internal.exceptions.checked.GenieJobResolutionException
dryRunJobSpecificationResolution in interface AgentJobServicejobRequest - The job request containing all the metadata needed to resolve a job specificationcom.netflix.genie.common.internal.exceptions.checked.GenieJobResolutionException - On error resolving the job given the input parameters and system statepublic void claimJob(@NotBlank
@NotBlank java.lang.String id,
@Valid
@Valid com.netflix.genie.common.external.dtos.v4.AgentClientMetadata agentClientMetadata)
id to be owned by the agent identified by agentClientMetadata. The
job status in the system will be set to JobStatus.CLAIMEDclaimJob in interface AgentJobServiceid - The id of the job to claim. Must exist in the system.agentClientMetadata - The metadata about the client claiming the jobpublic void updateJobStatus(@NotBlank
@NotBlank java.lang.String id,
com.netflix.genie.common.external.dtos.v4.JobStatus currentStatus,
com.netflix.genie.common.external.dtos.v4.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.updateJobStatus in interface AgentJobServiceid - 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 changepublic com.netflix.genie.common.external.dtos.v4.JobStatus getJobStatus(@NotBlank
@NotBlank java.lang.String id)
id.getJobStatus in interface AgentJobServiceid - The id of the job to look up.public void updateJobArchiveStatus(@NotBlank
@NotBlank java.lang.String id,
com.netflix.genie.common.external.dtos.v4.ArchiveStatus newArchiveStatus)
id to be newStatus.
Notice this is a 'blind write', the currently persisted value will always be overwritten.updateJobArchiveStatus in interface AgentJobServiceid - The id of the job to update status for. Must exist in the system.newArchiveStatus - The new archive status the caller would like to update the status to