hudson.model.Hudson.getLabels()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中hudson.model.Hudson.getLabels()方法的一些代码示例,展示了Hudson.getLabels()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.getLabels()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:getLabels

Hudson.getLabels介绍

[英]Gets all the active labels in the current system.
[中]获取当前系统中的所有活动标签。

代码示例

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
  protected void doRun() {
    Hudson h = Hudson.getInstance();
    h.overallNodeProvisioner.update();
    for( Label l : h.getLabels() )
      l.nodeProvisioner.update();
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

@Override
  protected void doRun() {
    Hudson h = Hudson.getInstance();
    h.overallNodeProvisioner.update();
    for (Label l : h.getLabels()) {
      l.nodeProvisioner.update();
    }
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
  protected void doRun() {
    Hudson h = Hudson.getInstance();
    h.overallNodeProvisioner.update();
    for( Label l : h.getLabels() )
      l.nodeProvisioner.update();
  }
}

代码示例来源:origin: hudson/hudson-2.x

@Override
  protected void doRun() {
    Hudson h = Hudson.getInstance();
    h.overallNodeProvisioner.update();
    for( Label l : h.getLabels() )
      l.nodeProvisioner.update();
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public Set<Label> getBuildableLabels(AbstractProject job) {
  if (isTeamManagementEnabled()) {
    Set<Label> availableLabels = getLabels();
    Set<Label> buildableLabels = new TreeSet<Label>();
    for (Label availableLabel : availableLabels) {
      boolean buildable = true;
      for (Node node : availableLabel.getNodes()) {
        String name = node.getNodeName();
        if (node instanceof Hudson) {
          name = "Master";
        }
        if (!getTeamManager().canNodeExecuteJob(name, job.getName())) {
          buildable = false;
        }
      }
      if (buildable) {
        buildableLabels.add(availableLabel);
      }
    }
    return buildableLabels;
  } else {
    return getLabels();
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
    AutoCompletionCandidates c = new AutoCompletionCandidates();
    Set<Label> labels = Hudson.getInstance().getLabels();
    List<String> queries = new AutoCompleteSeeder(value).getSeeds();
    for (String term : queries) {
      for (Label l : labels) {
        if (l.getName().startsWith(term)) {
          c.add(l.getName());
        }
      }
    }
    return c;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
    AutoCompletionCandidates c = new AutoCompletionCandidates();
    Set<Label> labels = Hudson.getInstance().getLabels();
    List<String> queries = new AutoCompleteSeeder(value).getSeeds();
    for (String term : queries) {
      for (Label l : labels) {
        if (l.getName().startsWith(term)) {
          c.add(l.getName());
        }
      }
    }
    return c;
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
    AutoCompletionCandidates c = new AutoCompletionCandidates();
    Set<Label> labels = Hudson.getInstance().getLabels();
    List<String> queries = new AutoCompleteSeeder(value).getSeeds();
    for (String term : queries) {
      for (Label l : labels) {
        if (l.getName().startsWith(term)) {
          c.add(l.getName());
        }
      }
    }
    return c;
  }
}

代码示例来源:origin: hudson/hudson-2.x

public AutoCompletionCandidates doAutoCompleteAssignedLabelString(@QueryParameter String value) {
    AutoCompletionCandidates c = new AutoCompletionCandidates();
    Set<Label> labels = Hudson.getInstance().getLabels();
    List<String> queries = new AutoCompleteSeeder(value).getSeeds();
    for (String term : queries) {
      for (Label l : labels) {
        if (l.getName().startsWith(term)) {
          c.add(l.getName());
        }
      }
    }
    return c;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

protected void doRun() {
    Hudson h = Hudson.getInstance();
    List<hudson.model.Queue.BuildableItem> bis = h.getQueue().getBuildableItems();
    // update statistics on slaves
    for( Label l : h.getLabels() ) {
      l.loadStatistics.totalExecutors.update(l.getTotalExecutors());
      l.loadStatistics.busyExecutors .update(l.getBusyExecutors());
      int q=0;
      for (hudson.model.Queue.BuildableItem bi : bis) {
        if(bi.task.getAssignedLabel()==l)
          q++;
      }
      l.loadStatistics.queueLength.update(q);
    }
    // update statistics of the entire system
    ComputerSet cs = new ComputerSet();
    h.overallLoad.totalExecutors.update(cs.getTotalExecutors());
    h.overallLoad.busyExecutors .update(cs.getBusyExecutors());
    int q=0;
    for (hudson.model.Queue.BuildableItem bi : bis) {
      if(bi.task.getAssignedLabel()==null)
        q++;
    }
    h.overallLoad.queueLength.update(q);
    h.overallLoad.totalQueueLength.update(bis.size());
  }
}

代码示例来源:origin: hudson/hudson-2.x

protected void doRun() {
    Hudson h = Hudson.getInstance();
    List<hudson.model.Queue.BuildableItem> bis = h.getQueue().getBuildableItems();
    // update statistics on slaves
    for( Label l : h.getLabels() ) {
      l.loadStatistics.totalExecutors.update(l.getTotalExecutors());
      l.loadStatistics.busyExecutors .update(l.getBusyExecutors());
      int q=0;
      for (hudson.model.Queue.BuildableItem bi : bis) {
        if(bi.task.getAssignedLabel()==l)
          q++;
      }
      l.loadStatistics.queueLength.update(q);
    }
    // update statistics of the entire system
    ComputerSet cs = new ComputerSet();
    h.overallLoad.totalExecutors.update(cs.getTotalExecutors());
    h.overallLoad.busyExecutors .update(cs.getBusyExecutors());
    int q=0;
    for (hudson.model.Queue.BuildableItem bi : bis) {
      if(bi.task.getAssignedLabel()==null)
        q++;
    }
    h.overallLoad.queueLength.update(q);
    h.overallLoad.totalQueueLength.update(bis.size());
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

protected void doRun() {
    Hudson h = Hudson.getInstance();
    List<hudson.model.Queue.BuildableItem> bis = h.getQueue().getBuildableItems();
    // update statistics on slaves
    for( Label l : h.getLabels() ) {
      l.loadStatistics.totalExecutors.update(l.getTotalExecutors());
      l.loadStatistics.busyExecutors .update(l.getBusyExecutors());
      int q=0;
      for (hudson.model.Queue.BuildableItem bi : bis) {
        if(bi.task.getAssignedLabel()==l)
          q++;
      }
      l.loadStatistics.queueLength.update(q);
    }
    // update statistics of the entire system
    ComputerSet cs = new ComputerSet();
    h.overallLoad.totalExecutors.update(cs.getTotalExecutors());
    h.overallLoad.busyExecutors .update(cs.getBusyExecutors());
    int q=0;
    for (hudson.model.Queue.BuildableItem bi : bis) {
      if(bi.task.getAssignedLabel()==null)
        q++;
    }
    h.overallLoad.queueLength.update(q);
    h.overallLoad.totalQueueLength.update(bis.size());
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

protected void doRun() {
    Hudson h = Hudson.getInstance();
    List<hudson.model.Queue.BuildableItem> bis = h.getQueue().getBuildableItems();
    // update statistics on slaves
    for (Label l : h.getLabels()) {
      l.loadStatistics.totalExecutors.update(l.getTotalExecutors());
      l.loadStatistics.busyExecutors.update(l.getBusyExecutors());
      int q = 0;
      for (hudson.model.Queue.BuildableItem bi : bis) {
        if (bi.task.getAssignedLabel() == l) {
          q++;
        }
      }
      l.loadStatistics.queueLength.update(q);
    }
    // update statistics of the entire system
    ComputerSet cs = new ComputerSet();
    h.overallLoad.totalExecutors.update(cs.getTotalExecutors());
    h.overallLoad.busyExecutors.update(cs.getBusyExecutors());
    int q = 0;
    for (hudson.model.Queue.BuildableItem bi : bis) {
      if (bi.task.getAssignedLabel() == null) {
        q++;
      }
    }
    h.overallLoad.queueLength.update(q);
    h.overallLoad.totalQueueLength.update(bis.size());
  }
}

相关文章

微信公众号

最新文章

更多

Hudson类方法