本文整理了Java中hudson.model.Node.getAssignedLabels()
方法的一些代码示例,展示了Node.getAssignedLabels()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getAssignedLabels()
方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getAssignedLabels
[英]Returns the possibly empty set of labels that are assigned to this node, including the automatic #getSelfLabel(), manually assigned labels and dynamically assigned labels via the LabelFinder extension point. This method has a side effect of updating the hudson-wide set of labels and should be called after events that will change that - e.g. a slave connecting.
[中]返回分配给此节点的可能为空的标签集,包括自动#getSelfLabel()、手动分配的标签和通过LabelFinder扩展点动态分配的标签。此方法的副作用是更新hudson范围内的标签集,并且应在将改变该方法的事件后调用,例如,从机连接。
代码示例来源:origin: jenkinsci/jenkins
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(),new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobCount();
}
});
}
/**
代码示例来源:origin: jenkinsci/jenkins
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: jenkinsci/jenkins
@Exported
public Set<LabelAtom> getAssignedLabels() {
Node node = getNode();
return (node != null) ? node.getAssignedLabels() : Collections.EMPTY_SET;
}
代码示例来源:origin: jenkinsci/jenkins
slave.getAssignedLabels();
getAssignedLabels();
代码示例来源:origin: jenkinsci/jenkins
@Override
public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.getInstance();
String rootUrl = jenkins.getRootUrl();
if(rootUrl!=null) {
env.put("JENKINS_URL", rootUrl);
env.put("HUDSON_URL", rootUrl); // Legacy compatibility
env.put("JOB_URL", rootUrl+j.getUrl());
}
String root = jenkins.getRootDir().getPath();
env.put("JENKINS_HOME", root);
env.put("HUDSON_HOME", root); // legacy compatibility
Thread t = Thread.currentThread();
if (t instanceof Executor) {
Executor e = (Executor) t;
env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
if (e.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME", e.getOwner().getName());
}
Node n = e.getOwner().getNode();
if (n != null)
env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
}
}
}
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
public Set<LabelAtom> superGetAssignedLabels() {
return super.getAssignedLabels();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(),new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobs().size();
}
});
}
/**
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(),new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobCount();
}
});
}
/**
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(), new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobs().size();
}
});
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(),new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobs().size();
}
});
}
/**
代码示例来源:origin: hudson/hudson-2.x
/**
* Return the possibly empty tag cloud for the labels of this node.
*/
public TagCloud<LabelAtom> getLabelCloud() {
return new TagCloud<LabelAtom>(getAssignedLabels(),new WeightFunction<LabelAtom>() {
public float weight(LabelAtom item) {
return item.getTiedJobs().size();
}
});
}
/**
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: hudson/hudson-2.x
public final boolean matches(Node n) {
return matches(n.getAssignedLabels());
}
代码示例来源:origin: jenkinsci/swarm-plugin
/**
* Remove labels from a slave
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void doRemoveSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
@QueryParameter String secret, @QueryParameter String labels) throws IOException {
if (!getSwarmSecret().equals(secret)) {
rsp.setStatus(SC_FORBIDDEN);
return;
}
Node nn = getNodeByName(name, rsp);
if (nn == null) {
return;
}
String sCurrentLabels = nn.getLabelString();
List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
HashSet<String> hs = new HashSet<>(lCurrentLabels);
List<String> lBadLabels = Arrays.asList(labels.split("\\s+"));
hs.removeAll(lBadLabels);
nn.setLabelString(hashSetToString(hs));
nn.getAssignedLabels();
normalResponse(req, rsp, nn.getLabelString());
}
代码示例来源:origin: jenkinsci/swarm-plugin
/**
* Adds labels to a slave.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void doAddSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
@QueryParameter String secret, @QueryParameter String labels) throws IOException{
if (!getSwarmSecret().equals(secret)) {
rsp.setStatus(SC_FORBIDDEN);
return;
}
Node nn = getNodeByName(name, rsp);
if (nn == null) {
return;
}
String sCurrentLabels = nn.getLabelString();
List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
HashSet<String> hs = new HashSet<>(lCurrentLabels);
List<String> lNewLabels = Arrays.asList(labels.split("\\s+"));
hs.addAll(lNewLabels);
nn.setLabelString(hashSetToString(hs));
nn.getAssignedLabels();
normalResponse(req, rsp, nn.getLabelString());
}
代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper
@Override
@Exported
public Set<LabelAtom> getAssignedLabels() {
initPython();
if (pexec.isImplemented(4)) {
return (Set) pexec.execPython("get_assigned_labels");
} else {
return super.getAssignedLabels();
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.getInstance();
String rootUrl = jenkins.getRootUrl();
if(rootUrl!=null) {
env.put("JENKINS_URL", rootUrl);
env.put("HUDSON_URL", rootUrl); // Legacy compatibility
env.put("JOB_URL", rootUrl+j.getUrl());
}
String root = jenkins.getRootDir().getPath();
env.put("JENKINS_HOME", root);
env.put("HUDSON_HOME", root); // legacy compatibility
Thread t = Thread.currentThread();
if (t instanceof Executor) {
Executor e = (Executor) t;
env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
if (e.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME", e.getOwner().getName());
}
Node n = e.getOwner().getNode();
if (n != null)
env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!