[Title] Fixed a bug about remote server status
authordonghee yang <donghee.yang@samsung.com>
Wed, 12 Dec 2012 15:20:05 +0000 (00:20 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Wed, 12 Dec 2012 15:20:05 +0000 (00:20 +0900)
package/changelog
package/pkginfo.manifest
src/build_server/RemoteBuildServer.rb
src/build_server/SocketJobRequestListener.rb

index 874391ce9880c8bf9136f75ed9f2fca0454312ce..c7adccfdc003115e2f72500404570589ccf18b8c 100644 (file)
@@ -1,3 +1,6 @@
+* 2.0.4
+- Fixed below bug again 
+== donghee yang <donghee.yang@samsung.com> 2012-12-12
 * 2.0.3
 - fixed bug about web, build-cli query
 == donghee yang <donghee.yang@samsung.com> 2012-12-12
index a258df4f5f85e2667fc52b81ebddc78ecf1b3af7..a804e1c12fb4dac133c18626aa1ecbbdff4f4236 100644 (file)
@@ -1,5 +1,5 @@
 Source : dibs
-Version :2.0.3
+Version :2.0.4
 Maintainer : taejun ha<taejun.ha@samsung.com>, jiil hyoun <jiil.hyoun@samsung.com>, donghyuk yang <donghyouk.yang@samsung.com>, donghee yang <donghee.yang@samsung.com>, sungmin kim <dev.sungmin.kim@samsung.com
 
 Package : dibs
index 3f8c557c4093a12230bae9011bca5b4bf34902e3..d643e1e6976a4306444a8b3e4a6f5f641859bfd1 100644 (file)
@@ -34,7 +34,7 @@ require 'thread'
 
 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
 
@@ -48,7 +48,9 @@ class RemoteBuildServer
                @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
@@ -130,31 +132,33 @@ class RemoteBuildServer
                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
 
 
@@ -222,8 +226,8 @@ class RemoteBuildServer
                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
index 7f864f35d9e7c782f1424404ee47065c9bd22623..8dc6d177e56803f85b3705e726e994ae1809ce96 100644 (file)
@@ -575,7 +575,7 @@ class SocketJobRequestListener
                        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)