class RemoteBuildServer
attr_accessor :id, :ip, :port, :description, :status, :host_os
- attr_accessor :max_working_jobs, :working_jobs, :waiting_jobs
+ attr_accessor :max_working_jobs, :working_jobs, :waiting_jobs, :working_job_count, :waiting_job_count
attr_accessor :path
attr_accessor :jobmgr, :distmgr
@host_os = Utils::HOST_OS
@max_working_jobs = 2
@working_jobs = []
+ @working_job_count = 0
@waiting_jobs = []
+ @waiting_job_count = 0
@path = ""
@file_transfer_cnt_mutex = Mutex.new
@file_transfer_cnt = 0
if @status == "DISCONNECTED" then
db.do "UPDATE remote_build_servers SET status = 'DISCONNECTED', max_job_count = 0, working_job_count = 0, waiting_job_count = 0 WHERE id = #{@id}"
else
+ @working_job_count = @working_jobs.count
+ @waiting_job_count = @waiting_jobs.count
db.do "UPDATE remote_build_servers SET
status = '#{@status}',
supported_os_id = (SELECT supported_os.id FROM supported_os WHERE supported_os.name = '#{@host_os}'),
max_job_count = #{@max_working_jobs},
- working_job_count = #{@working_jobs.count},
- waiting_job_count = #{@waiting_jobs.count} WHERE id = #{@id}"
+ working_job_count = #{@working_job_count},
+ waiting_job_count = #{@waiting_job_count} WHERE id = #{@id}"
end
end
# return available working slot
def get_number_of_empty_room
- return @max_working_jobs - @working_jobs.count
+ return @max_working_jobs - @working_job_count
end
# check there are working jobs
def has_working_jobs
- return (@working_jobs.count > 0)
+ return (@working_job_count > 0)
end
# check there are waiting jobs
def has_waiting_jobs
- return (@waiting_jobs.count > 0)
+ return (@waiting_job_count > 0)
end
new_obj.set_id( row['id'] )
new_obj.status = row['status']
new_obj.max_working_jobs =row['max_job_count']
- new_obj.working_jobs =row['working_job_count']
- new_obj.waiting_jobs =row['waiting_job_count']
+ new_obj.working_job_count =row['working_job_count']
+ new_obj.waiting_job_count =row['waiting_job_count']
return new_obj
end
BuildCommServer.send_begin(req)
# print GIT projects
@parent_server.remote_servers.each do |server|
- BuildCommServer.send(req,"#{server.status},#{server.host_os},#{server.waiting_jobs.length},#{server.working_jobs.length},#{server.max_working_jobs},#{server.get_file_transfer_cnt}")
+ BuildCommServer.send(req,"#{server.status},#{server.host_os},#{server.waiting_job_count},#{server.working_job_count},#{server.max_working_jobs},#{server.get_file_transfer_cnt}")
end
BuildCommServer.send_end(req)
BuildCommServer.disconnect(req)