attr != "FTP_ADDR" and attr != "FTP_PORT" and
attr != "FTP_USERNAME" and attr != "FTP_PASSWD" and
attr != "DB_DSN" and attr != "DB_USER" and
- attr != "DB_PASSWD" and attr != "PASSWORD" then
+ attr != "DB_PASSWD" and attr != "PASSWORD" and
+ attr != "MAX_WORKING_JOBS" then
puts BuildServerException.get_message("ERR021")
return false
attr != "FTP_ADDR" and attr != "FTP_PORT" and
attr != "FTP_USERNAME" and attr != "FTP_PASSWD" and
attr != "DB_DSN" and attr != "DB_USER" and
- attr != "DB_PASSWD" and attr != "PASSWORD" then
+ attr != "DB_PASSWD" and attr != "PASSWORD" and
+ attr != "MAX_WORKING_JOBS" then
puts BuildServerException.get_message("ERR021")
return false
f.puts "DB_DSN=#{server.db_dsn}"
f.puts "DB_USER=#{server.db_user}"
f.puts "DB_PASSWORD=#{server.db_passwd}"
+ if not server.has_db? then
+ f.puts "MAX_WORKING_JOBS=#{server.jobmgr.max_working_jobs}"
+ end
end
end
db_dsn=nil
db_user=nil
db_passwd=nil
+ max_working_jobs=2
# read configuration
server_dir = "#{BuildServer::CONFIG_ROOT}/#{id}"
if not l[idx,length].strip.eql? id then
raise RuntimeError, "Server configuration FAILED: #{server_dir}/server.cfg: ID must be \"#{id}\""
end
+ elsif l.start_with?("MAX_WORKING_JOBS=")
+ max_working_jobs = l[idx,length].strip.to_i
else
next
end
obj.db_user = db_user
obj.db_passwd = db_passwd
+ # max working jobs
+ if not obj.has_db? then
+ obj.jobmgr.max_working_jobs = max_working_jobs
+ end
+
# save config
#write_server_config( obj )
@new_job_index = 0
@internal_job_schedule = Mutex.new
@latest_job_touch = Mutex.new
+ @max_build_jobs = 2
end
def cancel_broken_status
end
def max_working_jobs
- result = nil
- @server.get_db_connection() do |db|
- result = db.select_one("SELECT value FROM server_configs WHERE property = 'max_working_jobs'")[0]
+ if @server.has_db? then
+ result = nil
+ @server.get_db_connection() do |db|
+ result = db.select_one("SELECT value FROM server_configs WHERE property = 'max_working_jobs'")[0]
+ end
+ @max_build_jobs = result.to_i if not result.nil?
end
- return (result.nil?) ? 2 : result.to_i
+
+ return @max_build_jobs
end
def max_working_jobs=(job_cnt)
- @server.get_db_connection() do |db|
- db.do "UPDATE server_configs SET value = '#{job_cnt}' WHERE property = 'max_working_jobs'"
+ @max_build_jobs = job_cnt
+
+ if @server.has_db? then
+ @server.get_db_connection() do |db|
+ db.do "UPDATE server_configs SET value = '#{@max_build_jobs}' WHERE property = 'max_working_jobs'"
+ end
end
end
+
# initialize
def init()
# load latest job idx if exist
--- /dev/null
+#PRE-EXEC
+rm -rf buildsvr01
+mkdir buildsvr01
+cd buildsvr01; ../../../build-svr create -n testserver3 -u `pwd`/../pkgsvr01/unstable -d 127.0.0.1:3333 -t ftp://ftpuser:ftpuser@172.21.111.124
+#EXEC
+../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 3
+../../build-svr get-attr -n testserver3 -A MAX_WORKING_JOBS
+#POST-EXEC
+../../build-svr remove -n testserver3
+rm -rf buildsvr01
+#EXPECT
+3
${RUBY} ../../build-svr add-os -n testserver3 -o windows-32
${RUBY} ../../build-svr add-prj -n testserver3 -N testa -g `pwd`/git01/a -b master
${RUBY} ../../build-svr add-prj -n testserver3 -N testb -g `pwd`/git01/b -b master
-${RUBY} ../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 1
+${RUBY} ../../build-svr set-attr -n testserver3 -A MAX_WORKING_JOBS -V 0
mkdir -p git01
cp ../git01/*.tar.gz git01/