@Validated @Transactional public class AgentJobServiceImpl extends java.lang.Object implements AgentJobService
AgentJobService.| Constructor and Description |
|---|
AgentJobServiceImpl(JobPersistenceService jobPersistenceService,
JobSpecificationService jobSpecificationService,
AgentFilterService agentFilterService,
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.internal.dto.v4.AgentClientMetadata agentClientMetadata)
Set a job identified by
id to be owned by the agent identified by agentClientMetadata. |
com.netflix.genie.common.internal.dto.v4.JobSpecification |
dryRunJobSpecificationResolution(@Valid com.netflix.genie.common.internal.dto.v4.JobRequest jobRequest)
Run the job specification resolution algorithm on the given input but save nothing in the system.
|
com.netflix.genie.common.internal.dto.v4.JobSpecification |
getJobSpecification(@NotBlank java.lang.String id)
Get a job specification if has been resolved.
|
void |
handshake(@Valid com.netflix.genie.common.internal.dto.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.internal.dto.v4.JobRequest jobRequest,
@Valid com.netflix.genie.common.internal.dto.v4.AgentClientMetadata agentClientMetadata)
Reserve a job id and persist job details in the database based on the supplied
JobRequest. |
com.netflix.genie.common.internal.dto.v4.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,
com.netflix.genie.common.dto.JobStatus currentStatus,
com.netflix.genie.common.dto.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(JobPersistenceService jobPersistenceService, JobSpecificationService jobSpecificationService, AgentFilterService agentFilterService, io.micrometer.core.instrument.MeterRegistry meterRegistry)
jobPersistenceService - The persistence service to usejobSpecificationService - The specification service to useagentFilterService - The agent filter service to usemeterRegistry - The metrics registry to usepublic void handshake(@Valid
@Valid com.netflix.genie.common.internal.dto.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.lang.String reserveJobId(@Valid
@Valid com.netflix.genie.common.internal.dto.v4.JobRequest jobRequest,
@Valid
@Valid com.netflix.genie.common.internal.dto.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.internal.dto.v4.JobSpecification resolveJobSpecification(@NotBlank
@NotBlank java.lang.String id)
resolveJobSpecification in interface AgentJobServiceid - The id of the job to resolve the specification for. Must already have a reserved an id in the database@Transactional(readOnly=true)
public com.netflix.genie.common.internal.dto.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.internal.dto.v4.JobSpecification dryRunJobSpecificationResolution(@Valid
@Valid com.netflix.genie.common.internal.dto.v4.JobRequest jobRequest)
dryRunJobSpecificationResolution in interface AgentJobServicejobRequest - The job request containing all the metadata needed to resolve a job specificationpublic void claimJob(@NotBlank
@NotBlank java.lang.String id,
@Valid
@Valid com.netflix.genie.common.internal.dto.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.dto.JobStatus currentStatus,
com.netflix.genie.common.dto.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 change