use of com.netflix.titus.api.jobmanager.model.job.CapacityAttributes in project titus-control-plane by Netflix.
the class DefaultJobManagementServiceGrpc method updateJobCapacityWithOptionalAttributes.
@Override
public void updateJobCapacityWithOptionalAttributes(JobCapacityUpdateWithOptionalAttributes request, StreamObserver<Empty> responseObserver) {
execute(callMetadataResolver, responseObserver, callMetadata -> {
CapacityAttributes capacityAttributes = GrpcJobManagementModelConverters.toCoreCapacityAttributes(request.getJobCapacityWithOptionalAttributes());
verifyServiceJob(request.getJobId(), capacityAttributes);
logger.info("updateJobCapacityWithOptionalAttributes to {}", capacityAttributes);
authorizeJobUpdate(callMetadata, request.getJobId()).concatWith(jobOperations.updateJobCapacityAttributesReactor(request.getJobId(), capacityAttributes, callMetadata)).subscribe(nothing -> {
}, e -> safeOnError(logger, e, responseObserver), () -> {
responseObserver.onNext(Empty.getDefaultInstance());
responseObserver.onCompleted();
});
});
}
use of com.netflix.titus.api.jobmanager.model.job.CapacityAttributes in project titus-control-plane by Netflix.
the class DefaultJobManagementServiceGrpc method updateJobCapacity.
@Override
public void updateJobCapacity(JobCapacityUpdate request, StreamObserver<Empty> responseObserver) {
execute(callMetadataResolver, responseObserver, callMetadata -> {
CapacityAttributes capacityAttributes = GrpcJobManagementModelConverters.toCoreCapacityAttributes(request.getCapacity());
verifyServiceJob(request.getJobId(), capacityAttributes);
authorizeJobUpdate(callMetadata, request.getJobId()).concatWith(jobOperations.updateJobCapacityAttributesReactor(request.getJobId(), capacityAttributes, callMetadata)).subscribe(nothing -> {
}, e -> safeOnError(logger, e, responseObserver), () -> {
responseObserver.onNext(Empty.getDefaultInstance());
responseObserver.onCompleted();
});
});
}
use of com.netflix.titus.api.jobmanager.model.job.CapacityAttributes in project titus-control-plane by Netflix.
the class SanitizingJobServiceGateway method updateJobCapacityWithOptionalAttributes.
@Override
public Completable updateJobCapacityWithOptionalAttributes(JobCapacityUpdateWithOptionalAttributes jobCapacityUpdateWithOptionalAttributes, CallMetadata callMetadata) {
final JobCapacityWithOptionalAttributes jobCapacityWithOptionalAttributes = jobCapacityUpdateWithOptionalAttributes.getJobCapacityWithOptionalAttributes();
CapacityAttributes capacityAttributes = GrpcJobManagementModelConverters.toCoreCapacityAttributes(jobCapacityWithOptionalAttributes);
Set<ValidationError> violations = entitySanitizer.validate(capacityAttributes);
if (!violations.isEmpty()) {
return Completable.error(TitusServiceException.invalidArgument(violations));
}
return delegate.updateJobCapacityWithOptionalAttributes(jobCapacityUpdateWithOptionalAttributes, callMetadata);
}
use of com.netflix.titus.api.jobmanager.model.job.CapacityAttributes in project titus-control-plane by Netflix.
the class JobScenarioBuilder method changeCapacity.
public JobScenarioBuilder changeCapacity(Capacity newCapacity) {
ExtTestSubscriber<Void> subscriber = new ExtTestSubscriber<>();
CapacityAttributes capacityAttributes = JobModel.newCapacityAttributes(newCapacity).build();
jobOperations.updateJobCapacityAttributes(jobId, capacityAttributes, CHANGE_CAPACITY_CALL_METADATA).subscribe(subscriber);
autoAdvanceUntilSuccessful(() -> checkOperationSubscriberAndThrowExceptionIfError(subscriber));
return this;
}
Aggregations