Search in sources :

Example 1 with CapacityAttributes

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();
        });
    });
}
Also used : CapacityAttributes(com.netflix.titus.api.jobmanager.model.job.CapacityAttributes)

Example 2 with CapacityAttributes

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();
        });
    });
}
Also used : CapacityAttributes(com.netflix.titus.api.jobmanager.model.job.CapacityAttributes)

Example 3 with CapacityAttributes

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);
}
Also used : JobCapacityWithOptionalAttributes(com.netflix.titus.grpc.protogen.JobCapacityWithOptionalAttributes) CapacityAttributes(com.netflix.titus.api.jobmanager.model.job.CapacityAttributes) ValidationError(com.netflix.titus.common.model.sanitizer.ValidationError)

Example 4 with CapacityAttributes

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;
}
Also used : ExtTestSubscriber(com.netflix.titus.testkit.rx.ExtTestSubscriber) CapacityAttributes(com.netflix.titus.api.jobmanager.model.job.CapacityAttributes)

Aggregations

CapacityAttributes (com.netflix.titus.api.jobmanager.model.job.CapacityAttributes)4 ValidationError (com.netflix.titus.common.model.sanitizer.ValidationError)1 JobCapacityWithOptionalAttributes (com.netflix.titus.grpc.protogen.JobCapacityWithOptionalAttributes)1 ExtTestSubscriber (com.netflix.titus.testkit.rx.ExtTestSubscriber)1