remove restriction on slave to run single job at a time

The gearman plugin was restricting slaves to runnning
only one job at a time even though the slave may have the
ability to run multiple jobs in parallel (by having
multiple executors).  This commit fixes the restriction.

Change-Id: I62b4ff9d12474a5885c549f0b532366cb60fcbca
This commit is contained in:
Khai Do 2013-08-15 14:46:56 -07:00
parent 2d6558ead7
commit 9f388435d2
1 changed files with 5 additions and 5 deletions

View File

@ -27,21 +27,16 @@ import hudson.model.AbstractProject;
import hudson.model.Cause;
import hudson.model.Computer;
import hudson.model.Hudson;
import hudson.model.Node;
import hudson.model.Project;
import hudson.model.Queue;
import hudson.model.StringParameterValue;
import hudson.model.queue.QueueTaskFuture;
import hudson.slaves.OfflineCause;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@ -202,6 +197,11 @@ public class StartJobWorker extends AbstractGearmanFunction {
Queue.Executable exec = future.getStartCondition().get();
AbstractBuild<?, ?> currBuild = (AbstractBuild<?, ?>) exec;
if (!offlineWhenComplete) {
// Unlock the monitor for this worker
availability.unlock(worker);
}
long now = new Date().getTime();
int duration = (int) (now - currBuild.getStartTimeInMillis());
int estimatedDuration = (int) currBuild.getEstimatedDuration();