Class JobServiceProtoConverter
java.lang.Object
com.netflix.genie.common.internal.dtos.converters.JobServiceProtoConverter
Converter of proto messages for the
JobServiceGrpc.JobServiceImplBase
service to
and from V4 DTO POJO's.- Since:
- 4.0.0
- See Also:
-
com.netflix.genie.common.internal.dtos
com.netflix.genie.proto
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiontoAgentClientMetadataDto
(com.netflix.genie.proto.AgentMetadata agentMetadata) Convert a protoAgentMetadata
to anAgentClientMetadata
.com.netflix.genie.proto.ChangeJobArchiveStatusRequest
toChangeJobStatusArchiveRequestProto
(String jobId, ArchiveStatus archiveStatus) Creates a request to change the remote job archive status.com.netflix.genie.proto.ChangeJobStatusRequest
toChangeJobStatusRequestProto
(@NotBlank String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, String message) Convert parameters into ChangeJobStatusRequest for the server.com.netflix.genie.proto.ClaimJobRequest
toClaimJobRequestProto
(String jobId, AgentClientMetadata agentClientMetadata) Convert agent metadata and job id into a ClaimJobRequest for the server.com.netflix.genie.proto.ConfigureRequest
toConfigureRequestProto
(AgentClientMetadata agentClientMetadata) Convert parameters into ConfigureRequest for the server.com.netflix.genie.proto.DryRunJobSpecificationRequest
toDryRunJobSpecificationRequestProto
(AgentJobRequest jobRequest) Convert a V4 Job Request DTO into a gRPC dry run resolve job specification request to be sent to the server.com.netflix.genie.proto.GetJobStatusRequest
toGetJobStatusRequestProto
(String jobId) Creates a request to fetch the job status currently seen by the server.com.netflix.genie.proto.HandshakeRequest
toHandshakeRequestProto
(AgentClientMetadata agentClientMetadata) Convert parameters into HandshakeRequest for the server.toJobRequestDto
(com.netflix.genie.proto.DryRunJobSpecificationRequest request) Convert a gRPC request to dry run a job specification resolution into aJobRequest
for use within Genie server codebase.toJobRequestDto
(com.netflix.genie.proto.ReserveJobIdRequest request) Convert a gRPC reserve job id request into a V4 Job Request DTO for use within Genie codebase.toJobSpecificationDto
(com.netflix.genie.proto.JobSpecification protoSpec) Convert a response from server into a Job Specification DTO which can be used in the codebase free of gRPC.com.netflix.genie.proto.JobSpecification
toJobSpecificationProto
(JobSpecification jobSpecification) Convert a Job Specification DTO to a protobuf message representation.com.netflix.genie.proto.JobSpecificationRequest
Generate aJobSpecificationRequest
from the given job id.com.netflix.genie.proto.JobSpecificationResponse
toJobSpecificationResponseProto
(JobSpecification jobSpecification) Build aJobSpecificationResponse
out of the givenJobSpecification
.com.netflix.genie.proto.ReserveJobIdRequest
toReserveJobIdRequestProto
(AgentJobRequest jobRequest, AgentClientMetadata agentClientMetadata) Convert a V4 Job Request DTO into a gRPC reserve job id request to be sent to the server.
-
Constructor Details
-
JobServiceProtoConverter
public JobServiceProtoConverter()
-
-
Method Details
-
toReserveJobIdRequestProto
public com.netflix.genie.proto.ReserveJobIdRequest toReserveJobIdRequestProto(AgentJobRequest jobRequest, AgentClientMetadata agentClientMetadata) throws GenieConversionException Convert a V4 Job Request DTO into a gRPC reserve job id request to be sent to the server.- Parameters:
jobRequest
- The job request to convertagentClientMetadata
- The metadata about the agent- Returns:
- The request that should be sent to the server for a new Job Specification given the parameters
- Throws:
GenieConversionException
- if conversion fails
-
toJobSpecificationRequestProto
Generate aJobSpecificationRequest
from the given job id.- Parameters:
id
- The job id to generate the request for- Returns:
- The request instance
-
toJobRequestDto
public JobRequest toJobRequestDto(com.netflix.genie.proto.ReserveJobIdRequest request) throws GenieConversionException Convert a gRPC reserve job id request into a V4 Job Request DTO for use within Genie codebase.- Parameters:
request
- The request to convert- Returns:
- The job request
- Throws:
GenieConversionException
- if conversion fails
-
toDryRunJobSpecificationRequestProto
public com.netflix.genie.proto.DryRunJobSpecificationRequest toDryRunJobSpecificationRequestProto(AgentJobRequest jobRequest) throws GenieConversionException Convert a V4 Job Request DTO into a gRPC dry run resolve job specification request to be sent to the server.- Parameters:
jobRequest
- The job request to convert- Returns:
- The request that should be sent to the server for a new Job Specification given the parameters
- Throws:
GenieConversionException
- if conversion fails
-
toJobRequestDto
public JobRequest toJobRequestDto(com.netflix.genie.proto.DryRunJobSpecificationRequest request) throws GenieConversionException Convert a gRPC request to dry run a job specification resolution into aJobRequest
for use within Genie server codebase.- Parameters:
request
- The request to convert- Returns:
- The job request
- Throws:
GenieConversionException
- if conversion fails
-
toAgentClientMetadataDto
public AgentClientMetadata toAgentClientMetadataDto(com.netflix.genie.proto.AgentMetadata agentMetadata) Convert a protoAgentMetadata
to anAgentClientMetadata
.- Parameters:
agentMetadata
- The metadata to convert- Returns:
- The immutable DTO representation
-
toJobSpecificationResponseProto
public com.netflix.genie.proto.JobSpecificationResponse toJobSpecificationResponseProto(JobSpecification jobSpecification) Build aJobSpecificationResponse
out of the givenJobSpecification
.- Parameters:
jobSpecification
- The job specification to serialize- Returns:
- The response instance
-
toJobSpecificationDto
Convert a response from server into a Job Specification DTO which can be used in the codebase free of gRPC.- Parameters:
protoSpec
- The protobuf specification message- Returns:
- A job specification DTO
-
toJobSpecificationProto
public com.netflix.genie.proto.JobSpecification toJobSpecificationProto(JobSpecification jobSpecification) Convert a Job Specification DTO to a protobuf message representation.- Parameters:
jobSpecification
- TheJobSpecification
to convert- Returns:
- A
JobSpecification
instance
-
toClaimJobRequestProto
public com.netflix.genie.proto.ClaimJobRequest toClaimJobRequestProto(String jobId, AgentClientMetadata agentClientMetadata) Convert agent metadata and job id into a ClaimJobRequest for the server.- Parameters:
jobId
- job idagentClientMetadata
- agent metadata- Returns:
- a ClaimJobRequest
-
toChangeJobStatusRequestProto
public com.netflix.genie.proto.ChangeJobStatusRequest toChangeJobStatusRequestProto(@NotBlank @NotBlank String jobId, JobStatus currentJobStatus, JobStatus newJobStatus, @Nullable String message) Convert parameters into ChangeJobStatusRequest for the server.- Parameters:
jobId
- job idcurrentJobStatus
- the expected current status on the servernewJobStatus
- the new current status for this jobmessage
- an optional message to record with the state change- Returns:
- a ChangeJobStatusRequest
-
toHandshakeRequestProto
public com.netflix.genie.proto.HandshakeRequest toHandshakeRequestProto(AgentClientMetadata agentClientMetadata) throws GenieConversionException Convert parameters into HandshakeRequest for the server.- Parameters:
agentClientMetadata
- agent client metadata- Returns:
- a
HandshakeRequest
- Throws:
GenieConversionException
- if the inputs are invalid
-
toConfigureRequestProto
public com.netflix.genie.proto.ConfigureRequest toConfigureRequestProto(AgentClientMetadata agentClientMetadata) throws GenieConversionException Convert parameters into ConfigureRequest for the server.- Parameters:
agentClientMetadata
- agent client metadata- Returns:
- a
ConfigureRequest
- Throws:
GenieConversionException
- if the inputs are invalid
-
toGetJobStatusRequestProto
Creates a request to fetch the job status currently seen by the server.- Parameters:
jobId
- the job id- Returns:
- A
GetJobStatusRequest
message instance
-
toChangeJobStatusArchiveRequestProto
public com.netflix.genie.proto.ChangeJobArchiveStatusRequest toChangeJobStatusArchiveRequestProto(String jobId, ArchiveStatus archiveStatus) Creates a request to change the remote job archive status.- Parameters:
jobId
- the job idarchiveStatus
- the new archive status- Returns:
- a
ChangeJobArchiveStatusRequest
message instance
-