@ExportedBean public abstract class Label extends Actionable implements Comparable<Label>, ModelObjectWithChildren
Node
s.Jenkins.getLabels()
,
Jenkins.getLabel(String)
Modifier and Type | Class and Description |
---|---|
static class |
Label.ConverterImpl |
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
Modifier and Type | Field and Description |
---|---|
LoadStatistics |
loadStatistics |
protected String |
name
Display name of this label.
|
NodeProvisioner |
nodeProvisioner |
Modifier and Type | Method and Description |
---|---|
abstract <V,P> V |
accept(LabelVisitor<V,P> visitor,
P param)
Accepts a visitor and call its respective "onXYZ" method based no the actual type of 'this'.
|
Label |
and(Label rhs)
Returns the label that represents
this&&rhs |
int |
compareTo(Label that) |
boolean |
contains(Node node) |
ModelObjectWithContextMenu.ContextMenu |
doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
Generates the context menu to list up all the children.
|
boolean |
equals(Object that) |
static Label |
get(String l)
Obtains a label by its name.
|
Api |
getApi()
Expose this object to the remote API.
|
int |
getBusyExecutors()
Number of busy
Executor s that are carrying out some work right now. |
Set<Cloud> |
getClouds()
Gets all
Cloud s that can launch for this label. |
String |
getDescription()
Returns a human readable text that explains this label.
|
String |
getDisplayName()
Returns a human-readable text that represents this label.
|
abstract String |
getExpression()
Returns a label expression that represents this label.
|
int |
getIdleExecutors()
Number of idle
Executor s that can start working immediately. |
String |
getName()
Alias for
getDisplayName() . |
Set<Node> |
getNodes()
Gets all
Node s that belong to this label. |
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem . |
Set<Node> |
getSortedNodes() |
int |
getTiedJobCount()
Returns an approximate count of projects that are tied on this node.
|
List<AbstractProject> |
getTiedJobs()
Returns projects that are tied on this node.
|
int |
getTotalConfiguredExecutors()
Number of total
Executor s that belong to this label. |
int |
getTotalExecutors()
Number of total
Executor s that belong to this label that are functioning. |
String |
getUrl()
Relative URL from the context path, that ends with '/'.
|
int |
hashCode() |
Label |
iff(Label rhs)
Returns the label that represents
this<->rhs |
Label |
implies(Label rhs)
Returns the label that represents
this->rhs |
boolean |
isAssignable()
Can jobs be assigned to this label?
|
boolean |
isAtom()
Returns true iff this label is an atom.
|
boolean |
isEmpty()
|
boolean |
isOffline()
Returns true if all the nodes of this label is offline.
|
boolean |
isSelfLabel()
Returns true if this label is a "self label",
which means the label is the name of a
Node . |
Set<LabelAtom> |
listAtoms()
Lists up all the atoms contained in in this label.
|
boolean |
matches(Collection<LabelAtom> labels)
Evaluates whether the label expression is true when an entity owns the given set of
LabelAtom s. |
boolean |
matches(Node n) |
abstract boolean |
matches(VariableResolver<Boolean> resolver)
Evaluates whether the label expression is true given the specified value assignment.
|
Label |
not()
Returns the label that represents
!this |
Label |
or(Label rhs)
Returns the label that represents
this||rhs |
Label |
paren()
Returns the label that represents
(this)
This is a pointless operation for machines, but useful
for humans who find the additional parenthesis often useful |
static Set<LabelAtom> |
parse(String labels)
Convert a whitespace-separate list of tokens into a set of
Label s. |
static Label |
parseExpression(String labelExpression)
Parses the expression into a label expression tree.
|
abstract LabelOperatorPrecedence |
precedence()
Precedence of the top most operator.
|
String |
toString() |
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
@NonNull protected final transient String name
@Exported @NonNull public final transient LoadStatistics loadStatistics
@NonNull public final transient NodeProvisioner nodeProvisioner
protected Label(@NonNull String name)
@NonNull @Exported(visibility=2) public final String getName()
getDisplayName()
.@NonNull public String getDisplayName()
getDisplayName
in interface ModelObject
public abstract String getExpression()
public String getUrl()
public String getSearchUrl()
SearchItem
SearchItem
.getSearchUrl
in interface SearchItem
public boolean isAtom()
public abstract boolean matches(VariableResolver<Boolean> resolver)
public final boolean matches(Collection<LabelAtom> labels)
LabelAtom
s.public final boolean matches(Node n)
public boolean isSelfLabel()
Node
.@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) public Set<Node> getSortedNodes()
public boolean isAssignable()
The answer is yes if there is a reasonable basis to believe that Hudson can have an executor under this label, given the current configuration. This includes situations such as (1) there are offline agents that have this label (2) clouds exist that can provision agents that have this label.
public int getTotalConfiguredExecutors()
Executor
s that belong to this label.
This includes executors that belong to offline nodes, so the result
can be thought of as a potential capacity, whereas getTotalExecutors()
is the currently functioning total number of executors.
This method doesn't take the dynamically allocatable nodes (via Cloud
)
into account. If you just want to test if there's some executors, use isAssignable()
.
@Exported public int getTotalExecutors()
Executor
s that belong to this label that are functioning.
This excludes executors that belong to offline nodes.
@Exported public int getBusyExecutors()
Executor
s that are carrying out some work right now.@Exported public int getIdleExecutors()
Executor
s that can start working immediately.@Exported public boolean isOffline()
@Exported public String getDescription()
@Exported public List<AbstractProject> getTiedJobs()
public int getTiedJobCount()
getTiedJobs().size()
but significantly faster as it involves fewer temporary objects and avoids
sorting the intermediary list. In a system with security, this will likely return a higher value as it counts
all jobs (mostly) irrespective of access.public boolean contains(Node node)
public boolean isEmpty()
public Api getApi()
public abstract <V,P> V accept(LabelVisitor<V,P> visitor, P param)
public Set<LabelAtom> listAtoms()
public Label not()
!this
public Label paren()
(this)
This is a pointless operation for machines, but useful
for humans who find the additional parenthesis often usefulpublic abstract LabelOperatorPrecedence precedence()
public final int compareTo(Label that)
compareTo
in interface Comparable<Label>
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
ModelObjectWithChildren
doChildrenContextMenu
in interface ModelObjectWithChildren
Exception
@NonNull public static Set<LabelAtom> parse(@CheckForNull String labels)
Label
s.labels
- Strings like "abc def ghi". Can be empty or null.Copyright © 2004–2022. All rights reserved.