add the canvas version to delayed_jobs_pool proc name

test plan: with a VERSION file in your rails root, run delayed jobs, the
process name will include the contents of the VERSION file. with no
VERSION file, it won't.

Change-Id: I773ff4ace5facdb48d415ad7528daaf761aeab1d
Reviewed-on: https://gerrit.instructure.com/40162
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2014-08-27 22:49:59 -06:00
parent 122c7393c7
commit d6c9d87f76
3 changed files with 15 additions and 6 deletions

View File

@ -5,7 +5,7 @@
%> %>
<span class="small pull-right"> <span class="small pull-right">
Revision: <%= Canvas.revision %> Revision: <%= Canvas.revision || t('#canvas_revision_unknown', "Unknown") %>
</span> </span>
<h2> <h2>

View File

@ -145,11 +145,12 @@ module Canvas
end end
def self.revision def self.revision
return @revision unless @revision.nil? return @revision if defined?(@revision)
if File.file?(Rails.root+"VERSION") @revision = if File.file?(Rails.root+"VERSION")
@revision = File.readlines(Rails.root+"VERSION").first.try(:strip) File.readlines(Rails.root+"VERSION").first.try(:strip)
else
nil
end end
@revision ||= I18n.t(:canvas_revision_unknown, "Unknown")
end end
# protection against calling external services that could timeout or misbehave. # protection against calling external services that could timeout or misbehave.

View File

@ -82,12 +82,20 @@ class Pool
protected protected
def procname
name = "delayed_jobs_pool"
if Canvas.revision
name = "#{name} (#{Canvas.revision})"
end
name
end
def start def start
load_rails load_rails
tail_rails_log unless @daemon tail_rails_log unless @daemon
say "Started job master", :info say "Started job master", :info
$0 = "delayed_jobs_pool" $0 = procname
apply_config apply_config
# fork to handle unlocking (to prevent polluting the parent with worker objects) # fork to handle unlocking (to prevent polluting the parent with worker objects)