[Title] Modified to make build-server work when max-job is zero
authordonghee yang <donghee.yang@samsung.com>
Fri, 12 Apr 2013 00:15:32 +0000 (09:15 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Fri, 12 Apr 2013 00:15:32 +0000 (09:15 +0900)
src/build_server/BuildServer.rb
test/build-server.multi-svr1/03.testcase

index 6578bd957a27c7ba768e7974d1b3f248f735939f..2876721aa0ddb1867feef22309c6e71a0247aa6f 100644 (file)
@@ -489,8 +489,13 @@ class BuildServer
                end
 
                # get availables server
-               # but, job must not be "REGISTER" and "MULTIBUILD" job
-               if job.type != "REGISTER" and job.type != "MULTIBUILD" then
+               if job.type == "MULTIBUILD" or job.type == "REGISTER" then
+                       # if max working job is zero, check max-non-build-jobs
+                       if @jobmgr.max_working_jobs == 0 and local_empty_rooms >= -4 then
+                               candidates.push self
+                       end
+               else
+                       # if normal JOB
                        @remote_servers.each do |server|
                                if ( server.status == "RUNNING" and server.can_build?( job ) and
                                        not server.has_waiting_jobs and
@@ -501,11 +506,11 @@ class BuildServer
                        end
                end
 
-               best_server = candidates[0]
-               if best_server.nil? or candidates.count == 1 then return best_server end
+               if candidates.count == 0 then return nil end
 
                # get best
                # it is better if working jobs count is less
+               best_server = candidates[0]
                max_empty_room = best_server.get_number_of_empty_room
                candidates.each do |server|
                        # check whether idle, use it
index 30344d37e738decf17c65b410408fb337dd9b2e7..f0a6605b12076f0f6a0e20d69fc36b8285c09604 100644 (file)
@@ -1,9 +1,7 @@
 #PRE-EXEC
-../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 1
 #EXEC
 ../../build-cli build -N testa,testb -d 127.0.0.1:2223 -o ubuntu-32 -D unstable --rebuild
 #POST-EXEC
-../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 0
 #EXPECT
 Info: Added new job
 Info: Initializing job...