use of com.netflix.titus.api.appscale.model.AutoScalableTarget in project titus-control-plane by Netflix.
the class DefaultAppScaleManager method addScalableTargetIfNew.
private void addScalableTargetIfNew(String jobId) {
if (!scalableTargets.containsKey(jobId)) {
metrics.reportNewScalableTarget();
AutoScalableTarget autoScalableTarget = AutoScalableTarget.newBuilder().build();
scalableTargets.put(jobId, autoScalableTarget);
}
}
use of com.netflix.titus.api.appscale.model.AutoScalableTarget in project titus-control-plane by Netflix.
the class AWSAppAutoScalingClient method getScalableTargetsForJob.
@Override
public Observable<AutoScalableTarget> getScalableTargetsForJob(String jobId) {
DescribeScalableTargetsRequest describeScalableTargetsRequest = new DescribeScalableTargetsRequest();
describeScalableTargetsRequest.setServiceNamespace(SERVICE_NAMESPACE);
describeScalableTargetsRequest.setScalableDimension(SCALABLE_DIMENSION);
describeScalableTargetsRequest.setResourceIds(Collections.singletonList(AWSAppAutoScalingUtil.buildGatewayResourceId(jobId, awsAppScalingConfig.getAWSGatewayEndpointPrefix(), awsAppScalingConfig.getRegion(), awsAppScalingConfig.getAWSGatewayEndpointTargetStage())));
return RetryWrapper.wrapWithExponentialRetry(String.format("getScalableTargetsForJob for job %s", jobId), Observable.create(emitter -> awsAppAutoScalingClientAsync.describeScalableTargetsAsync(describeScalableTargetsRequest, new AsyncHandler<DescribeScalableTargetsRequest, DescribeScalableTargetsResult>() {
@Override
public void onError(Exception exception) {
logger.error("Get scalable target exception for {} - {}", jobId, exception.getMessage());
awsAppAutoScalingMetrics.registerAwsGetTargetError(exception);
emitter.onError(exception);
}
@Override
public void onSuccess(DescribeScalableTargetsRequest request, DescribeScalableTargetsResult describeScalableTargetsResult) {
awsAppAutoScalingMetrics.registerAwsGetTargetSuccess();
List<ScalableTarget> scalableTargets = describeScalableTargetsResult.getScalableTargets();
scalableTargets.stream().map(AWSAppAutoScalingUtil::toAutoScalableTarget).forEach(emitter::onNext);
emitter.onCompleted();
}
}), Emitter.BackpressureMode.NONE));
}
use of com.netflix.titus.api.appscale.model.AutoScalableTarget in project titus-control-plane by Netflix.
the class NoOpAppAutoScalingClient method getScalableTargetsForJob.
@Override
public Observable<AutoScalableTarget> getScalableTargetsForJob(String jobId) {
AutoScalableTarget autoScalableTarget = AutoScalableTarget.newBuilder().withMinCapacity(1).withMaxCapacity(10).build();
log.info("Scalable targets for JobId {} - {}", jobId, autoScalableTarget);
return Observable.just(autoScalableTarget);
}
Aggregations