use of com.netflix.titus.grpc.protogen.JobCapacityUpdateWithOptionalAttributes in project titus-control-plane by Netflix.
the class JobManagementSpringResourceTest method testSetCapacityWithOptionalAttributes.
@Test
public void testSetCapacityWithOptionalAttributes() throws Exception {
JobCapacityWithOptionalAttributes restRequest = JobCapacityWithOptionalAttributes.newBuilder().setMin(UInt32Value.newBuilder().setValue(1).build()).setDesired(UInt32Value.newBuilder().setValue(2).build()).setMax(UInt32Value.newBuilder().setValue(3).build()).build();
JobCapacityUpdateWithOptionalAttributes forwardedRequest = JobCapacityUpdateWithOptionalAttributes.newBuilder().setJobId(JOB_ID_1).setJobCapacityWithOptionalAttributes(restRequest).build();
when(jobServiceGatewayMock.updateJobCapacityWithOptionalAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA)).thenReturn(Completable.complete());
SpringMockMvcUtil.doPut(mockMvc, String.format("/api/v3/jobs/%s/capacityAttributes", JOB_ID_1), restRequest);
verify(jobServiceGatewayMock, times(1)).updateJobCapacityWithOptionalAttributes(forwardedRequest, JUNIT_REST_CALL_METADATA);
}
use of com.netflix.titus.grpc.protogen.JobCapacityUpdateWithOptionalAttributes in project titus-control-plane by Netflix.
the class DefaultAppAutoScalingCallbackService method setScalableTargetResourceInfo.
@Override
public Observable<ScalableTargetResourceInfo> setScalableTargetResourceInfo(String jobId, ScalableTargetResourceInfo scalableTargetResourceInfo, CallMetadata callMetadata) {
logger.info("(BEFORE setting job instances) for jobId {} :: {}", jobId, scalableTargetResourceInfo);
JobCapacityWithOptionalAttributes jobCapacityWithOptionalAttributes = JobCapacityWithOptionalAttributes.newBuilder().setDesired(UInt32Value.newBuilder().setValue(scalableTargetResourceInfo.getDesiredCapacity()).build()).build();
JobCapacityUpdateWithOptionalAttributes jobCapacityRequest = JobCapacityUpdateWithOptionalAttributes.newBuilder().setJobId(jobId).setJobCapacityWithOptionalAttributes(jobCapacityWithOptionalAttributes).build();
return jobServiceGateway.updateJobCapacityWithOptionalAttributes(jobCapacityRequest, callMetadata).andThen(getScalableTargetResourceInfo(jobId, callMetadata).map(scalableTargetResourceInfoReturned -> {
scalableTargetResourceInfoReturned.setScalingStatus(ScalingStatus.Pending.name());
logger.info("(set job instances) Returning value Instances for jobId {} :: {}", jobId, scalableTargetResourceInfo);
return scalableTargetResourceInfoReturned;
}));
}
Aggregations