@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
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
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
require "logger"
-class NewLogger < Logger
- def flush
- @logdev.dev.flush
- end
-end
-
class Log
attr_accessor :path, :cnt, :logger
@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