From 31d4e48deb19eb14304639c82ce18d9bbf3d2f84 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 13 Nov 2006 22:29:58 +0000 Subject: [PATCH] implemented EXECUTOR_NUMBER variable. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1112 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Executor.java | 17 +++++++++++++++++ core/src/main/java/hudson/model/Run.java | 7 +++++++ war/resources/env-vars.html | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/core/src/main/java/hudson/model/Executor.java b/core/src/main/java/hudson/model/Executor.java index 313cb86498..4ed48d08c8 100644 --- a/core/src/main/java/hudson/model/Executor.java +++ b/core/src/main/java/hudson/model/Executor.java @@ -20,10 +20,16 @@ public class Executor extends Thread { private long startTime; + /** + * Executor number that identifies it among other executors for the same {@link Computer}. + */ + private int number; + public Executor(Computer owner) { super("Executor #"+owner.getExecutors().size()+" for "+owner.getDisplayName()); this.owner = owner; this.queue = Hudson.getInstance().getQueue(); + this.number = owner.getExecutors().size(); start(); } @@ -72,6 +78,17 @@ public class Executor extends Thread { return build; } + /** + * Gets the executor number that uniquely identifies it among + * other {@link Executor}s for the same computer. + * + * @return + * a sequential number starting from 0. + */ + public int getNumber() { + return number; + } + /** * Returns true if this {@link Executor} is ready for action. */ diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index c1b39eaf62..7eedc6f827 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -787,6 +787,13 @@ public abstract class Run ,RunT extends RunBUILD_TAG
String of "hudson-${JOBNAME}-${BUILD_NUMBER}". Convenient to put into a resource file, a jar file, etc for easier identification.
+ +
EXECUTOR_NUMBER
+
The unique number that identifies the current executor + (among executors of the same machine) that's + carrying out this build. This is the number you see in + the "build executor status", except that the number starts from 0, not 1.