From: dibs Date: Fri, 29 Mar 2013 12:23:14 +0000 (+0900) Subject: [title] Improve query log in web side X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5c18b86544e88a087a10e0fc96f92555de37a65;p=sdk%2Ftools%2Fsdk-build.git [title] Improve query log in web side --- diff --git a/build-cli b/build-cli index 555e9db..36b6578 100755 --- a/build-cli +++ b/build-cli @@ -313,6 +313,7 @@ begin exit 1 end output = option[:output] + flock = "ON" begin if output.nil? then @@ -322,11 +323,16 @@ begin raise RuntimeError, "The output file is already exist." end log = File.open(output, "w") + log.flock(File::LOCK_EX) puts "Started query log, writing to the file \"#{output}\"" end result = JobLog.monitor(addr[0], addr[1], option[:job].strip) do |line,status,errmsg| log.puts line + if flock.eql? "ON" then + log.flock(File::LOCK_UN) + flock = "OFF" + end end if result and not output.nil? then log.puts "=LOG_END" @@ -337,6 +343,7 @@ begin result = false rescue => e puts "ERROR: #{e}" + puts e.backtrace.inspect result = false ensure if not output.nil? then diff --git a/dibs-web/app/controllers/jobs_controller.rb b/dibs-web/app/controllers/jobs_controller.rb index 197440b..37b936e 100644 --- a/dibs-web/app/controllers/jobs_controller.rb +++ b/dibs-web/app/controllers/jobs_controller.rb @@ -178,11 +178,11 @@ class JobsController < ApplicationController end if(status == "ALL") - status = "'FINISHED', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" + status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" elsif(status == "SUCCESS") status = "'FINISHED'" elsif(status == "WORKING") - status = "'JUST_CREATE', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" + status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" elsif(status == "ERROR") status = "'ERROR', 'CANCELED'" end @@ -277,11 +277,11 @@ class JobsController < ApplicationController end if(status == "ALL") - status = "'FINISHED', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" + status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" elsif(status == "SUCCESS") status = "'FINISHED'" elsif(status == "WORKING") - status = "'JUST_CREATE', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" + status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" elsif(status == "ERROR") status = "'ERROR', 'CANCELED'" end @@ -367,11 +367,11 @@ class JobsController < ApplicationController end if(status == "ALL") - status = "'FINISHED', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" + status = "'FINISHED', 'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING', 'ERROR', 'CANCELED'" elsif(status == "SUCCESS") status = "'FINISHED'" elsif(status == "WORKING") - status = "'JUST_CREATE', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" + status = "'INITIALIZING', 'JUST_CREATED', 'WAITING', 'WORKING', 'REMOTE_WORKING', 'PENDING'" elsif(status == "ERROR") status = "'ERROR', 'CANCELED'" end @@ -558,6 +558,7 @@ class JobsController < ApplicationController if not File.exist?(path) then #if file does not exist then execute query-log command Utils.sbi_query_log_command(id, path) + sleep(1) conti = 1 else start_line = line diff --git a/dibs-web/public/index.html b/dibs-web/public/index.html index 529363d..597bad7 100644 --- a/dibs-web/public/index.html +++ b/dibs-web/public/index.html @@ -100,7 +100,7 @@ Contributors:
- +
diff --git a/dibs-web/public/javascripts/log.js b/dibs-web/public/javascripts/log.js index be17b7a..b5f0677 100644 --- a/dibs-web/public/javascripts/log.js +++ b/dibs-web/public/javascripts/log.js @@ -128,12 +128,13 @@ function queryLog() } function autoQueryLog(conti, working_status) { - if(conti && stop) { - queryLog(); - } - else if(working_status == 1 && stop) { + if(working_status == 1 && stop) { console.log("status is working. try request"); - setTimeout(function(){queryLog()}, 3000); + setTimeout(function(){queryLog()}, 1000); + } + else if(conti && stop) { + console.log("contiue request"); + setTimeout(function(){queryLog()}, 100); } }