blob: e35bb139142b3b963c335130cda6c91d780b59fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.maintenance;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentTrigger.TriggerResult;
import java.time.Duration;
/**
* Trigger ready deployment jobs. This drives jobs through each application's deployment pipeline.
*
* @author bratseth
*/
public class ReadyJobsTrigger extends ControllerMaintainer {
public ReadyJobsTrigger(Controller controller, Duration interval) {
super(controller, interval);
}
@Override
public double maintain() {
TriggerResult result = controller().applications().deploymentTrigger().triggerReadyJobs();
long total = result.triggered() + result.failed();
return total == 0 ? 1 : (double) result.triggered() / (result.triggered() + result.failed());
}
}
|