[title] removed about NewLog class, Job.status.
authordibs <dibs@samsung.com>
Wed, 27 Mar 2013 14:59:40 +0000 (23:59 +0900)
committerdibs <dibs@samsung.com>
Wed, 27 Mar 2013 14:59:40 +0000 (23:59 +0900)
build-cli
src/build_server/BuildServer.rb
src/build_server/CommonJob.rb
src/common/BuildComm.rb
src/common/log.rb

index 14bc404ae32ab39b409e8221e2f884501e5af1d5..0289834b1c216e0eb64434269b6e5a1c3a5e68cf 100755 (executable)
--- a/build-cli
+++ b/build-cli
@@ -217,9 +217,7 @@ begin
                        client.terminate
                rescue => e
                        puts "ERROR: #{e}"
-                       if not client.terminated? then
-                               client.terminate
-                       end
+                       client.terminate
                        exit 1
                end
 
@@ -256,9 +254,7 @@ begin
                        rescue => e
                                puts "ERROR: #{e}"
                                result = false
-                               if not client.terminated? then
-                                       client.terminate
-                               end
+                               client.terminate
                        end
                end
 
index 202d97fa8b4d3ef64f722b598a90c6a666d6152e..61b30596115abec639ee47283728deca3d8c7d98 100644 (file)
@@ -787,6 +787,7 @@ class BuildServer
                @log.info "Sending job log : #{job_number}"
 
                job = nil
+               job_status = ""
                (@jobmgr.jobs + @jobmgr.internal_jobs + @jobmgr.reverse_build_jobs).each do |manager_job|
                        if manager_job.id.eql? job_number then 
                                job = manager_job
@@ -805,6 +806,12 @@ class BuildServer
                                                        if line.strip.empty? then next end
                                                        BuildCommServer.send(conn, line) 
 
+                                                       # Send status when changed status
+                                                       if (not job.nil?) and (not job.status.eql?(job_status)) then
+                                                               job_status = job.status
+                                                               BuildCommServer.send(conn, "=JOB_STATUS,#{job_status}")
+                                                       end
+
                                                        # if read file's last line and job status ended then log file sending done
                                                        if log.eof? and (job.nil? or
                                                                         job.status.eql? "FINISHED" or
@@ -812,7 +819,6 @@ class BuildServer
                                                                         job.status.eql? "CANCELED") then
 
                                                                # Log file send done. & send job status
-                                                               job_status = ""
                                                                get_db_connection() do |db|
                                                                        job_status = db.select_one("SELECT status FROM jobs WHERE id = #{job_number}")[0]
                                                                end
index 23e3fa4a2b9dad441f8b600d4361892268ebefe3..a3522711a7ed77c80b06f9adf55b1cce4f72a387 100644 (file)
@@ -64,19 +64,6 @@ class CommonJob
                @sub_pid = 0
        end
 
-       # processing in updated status (set stauts)
-       def status=(value)
-               @status = value
-               if not @log.nil? then
-                       @log.job_status(@status, "")
-                       @log.logger.flush
-               end
-       end
-       
-       def status
-               return @status
-       end
-
        # event check
        def check_event
                # CANCEL/CANCELING
index 7e95dee35ba94741b313cf867d622da462535028..522163501e4a8d7c74d7c24aaff1911a9a858905 100644 (file)
@@ -373,10 +373,6 @@ class BuildCommClient
                return new(socket, log)
        end
 
-       def terminated?
-               return @socket.closed?
-       end
-
        def get_error_msg()
                return @error_msg
        end
index facd41c23b3ff13d0420e4fe9c6191553a6845cf..2933ac86c5d60b5f03d9f7819241b7d969a3b636 100644 (file)
@@ -28,12 +28,6 @@ Contributors:
 
 require "logger"
 
-class NewLogger < Logger
-       def flush
-               @logdev.dev.flush
-       end
-end
-
 class Log
 
        attr_accessor :path, :cnt, :logger
@@ -48,9 +42,9 @@ class Log
                @cnt = 0
                @path = path
                if @path.nil? then
-                       @logger = NewLogger.new(STDOUT)
+                       @logger = Logger.new(STDOUT)
                else
-                       @logger = NewLogger.new(path, "monthly")
+                       @logger = Logger.new(path, "monthly")
                end
                # if log level is bigger/equal to second out level
                # , we will send the log to second-out