public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Jenkins.getInstance().getQueue().countBuildableItemsFor(Label.this); } @Override protected Set<Node> getNodes() { return Label.this.getNodes(); } @Override protected boolean matches(Queue.Item item, SubTask subTask) { final Label l = item.getAssignedLabelFor(subTask); return l != null && Label.this.matches(l.name); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }
float m = calcThresholdMargin(totalSnapshot); if(excessWorkload>1-m) {// and there's more work to do... LOGGER.fine("Excess workload "+excessWorkload+" detected. (planned capacity="+plannedCapacity+",Qlen="+qlen+",idle="+idle+"&"+idleSnapshot+",total="+totalSnapshot+"m,="+m+")");
@Override protected void doRun() throws Exception { // Trigger reprovisioning as well Jenkins.getActiveInstance().unlabeledNodeProvisioner.suggestReviewNow(); final List<FleetStateStats> stats = new ArrayList<FleetStateStats>(); for(final Cloud cloud : Jenkins.getActiveInstance().clouds) { if (!(cloud instanceof EC2FleetCloud)) continue; // Update the cluster states final EC2FleetCloud fleetCloud =(EC2FleetCloud) cloud; LOGGER.log(Level.FINE, "Checking cloud: " + fleetCloud.getLabelString() ); stats.add(fleetCloud.updateStatus()); } for (final Widget w : Jenkins.getInstance().getWidgets()) { if (!(w instanceof FleetStatusWidget)) continue; ((FleetStatusWidget)w).setStatusList(stats); } } }
public void cleanCloudStatistics() { Jenkins jenkins = Jenkins.getInstance(); Set<ProvisioningActivity.Id> plannedNodesSet = new HashSet<>(); for (NodeProvisioner.PlannedNode node : jenkins.unlabeledNodeProvisioner.getPendingLaunches()) { if (node instanceof TrackedItem) { plannedNodesSet.add(((TrackedItem) node).getId()); } } for (Label l : jenkins.getLabels()) { for (NodeProvisioner.PlannedNode node : l.nodeProvisioner.getPendingLaunches()) { if (node instanceof TrackedItem) { plannedNodesSet.add(((TrackedItem) node).getId()); } } } for (Node node : jenkins.getNodes()) { if (node instanceof TrackedItem) { plannedNodesSet.add(((TrackedItem) node).getId()); } } Collection<ProvisioningActivity> activities = CloudStatistics.get().getNotCompletedActivities(); for (ProvisioningActivity activity : activities) { if (activity.getCurrentPhase().equals(ProvisioningActivity.Phase.PROVISIONING) && !plannedNodesSet.contains(activity.getId())) { Exception e = new Exception(String.format("Node %s has lost. Mark as failure", activity.getId().toString())); CloudStatistics.ProvisioningListener.get().onFailure(activity.getId(), e); } } }
float m = calcThresholdMargin(totalSnapshot); if(excessWorkload>1-m) {// and there's more work to do... LOGGER.fine("Excess workload "+excessWorkload+" detected. (planned capacity="+plannedCapacity+",Qlen="+qlen+",idle="+idle+"&"+idleSnapshot+",total="+totalSnapshot+"m,="+m+")");
@Override public void onEnterBuildable(Queue.BuildableItem item) { final Jenkins jenkins = Jenkins.getInstance(); final Label label = item.getAssignedLabel(); for (Cloud cloud : Jenkins.getInstance().clouds) { if (cloud instanceof DockerCloud && cloud.canProvision(label)) { final NodeProvisioner provisioner = (label == null ? jenkins.unlabeledNodeProvisioner : label.nodeProvisioner); provisioner.suggestReviewNow(); } } } }
public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Hudson.getInstance().getQueue().countBuildableItemsFor(Label.this); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }
float m = calcThresholdMargin(totalSnapshot); if(excessWorkload>1-m) {// and there's more work to do... LOGGER.fine("Excess workload "+excessWorkload+" detected. (planned capacity="+plannedCapacity+",Qlen="+qlen+",idle="+idle+"&"+idleSnapshot+",total="+totalSnapshot+"m,="+m+")");
public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Hudson.getInstance().getQueue().countBuildableItemsFor(Label.this); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }
float m = calcThresholdMargin(totalSnapshot); if (excessWorkload > 1 - m) {// and there's more work to do... LOGGER.fine("Excess workload " + excessWorkload + " detected. (planned capacity=" + plannedCapacity + ",Qlen=" + qlen + ",idle=" + idle + "&" + idleSnapshot + ",total=" + totalSnapshot + "m,=" + m + ")");
public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0, 0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Hudson.getInstance().getQueue().countBuildableItemsFor(Label.this); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }
public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Hudson.getInstance().getQueue().countBuildableItemsFor(Label.this); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }
public Label(String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { @Override public int computeIdleExecutors() { return Label.this.getIdleExecutors(); } @Override public int computeTotalExecutors() { return Label.this.getTotalExecutors(); } @Override public int computeQueueLength() { return Jenkins.getInstance().getQueue().countBuildableItemsFor(Label.this); } @Override protected Set<Node> getNodes() { return Label.this.getNodes(); } @Override protected boolean matches(Queue.Item item, SubTask subTask) { final Label l = item.getAssignedLabelFor(subTask); return l != null && Label.this.matches(l.name); } }; this.nodeProvisioner = new NodeProvisioner(this, loadStatistics); }