Skip to content

Instantly share code, notes, and snippets.

@lwoodson
Last active December 21, 2015 19:09
Show Gist options
  • Save lwoodson/6352244 to your computer and use it in GitHub Desktop.
Save lwoodson/6352244 to your computer and use it in GitHub Desktop.
AddendPerformanceProgramObjectives
AddendPerformanceProgramSchedule
ApplicantListWorker
ApplicationTransitionWorker
ChoreCreated
ChoresNotifications
EeoReportWorker
EmailWorker
EmployerStatsExportWorker
EmploymentTaskOpeningWorker
EnqueuePerformanceAttachmentPDFConversionPoller
EvaluateProgramEligibilityWorker
ExpirePoolApplicationsWorker
ForEachJobApplicationToPositionContext
HiringProposalTransitionWorker
ImportExportWithStatusWorker
KeywordIndexDeltaWorker
MaintainUserNestedSet
OnDemandReportWorker
PdfComboWorker
PdfGeneratorWorker
PerformanceEvaluationSubmitted
PerformanceProgramClosing
RunForEachEmployer
RunForEachProdEmployer
ScheduledBackgroundCheckReportStatusWorker
ScheduledEmployerMethodWorker
ScheduledExportWorker
ScheduledExportsReportWorker
ScheduledJobBoardPostingStatusWorker
ScheduledOnboardingEmailTasks
ScheduledOnboardingNotifications
ScheduledScriptWorker
ScheduledWorkflowTransitionWorker
SupervisorshipChangeWorker
SupplementalQuestionUpgradeWorker
SystemEventWorker
TaskflowTaskOpenDateReachedWorker
UniqueKeywordIndexDeltaWorker
UpdateAssessmentRankingsWorker
UpdateSearchCommitteeScoreWorker
require 'resque'
require_relative 'config/environment'
# This outputs the value of Resque.queue_from_class for each class that has been modified
# as detected with git status.
files = `git status | grep modified | grep -v qtrix | awk '{print $3}'`.split("\n")
files.each {|file| load file}
job_names = `git status | grep modified | grep -v qtrix | awk '{print $3}' | xargs grep ^class | awk '{print $2}'`.split("\n")
jobs = job_names.map{|name| name.strip.constantize}
jobs.each do |job|
puts Resque.queue_from_class(job)
end
require 'set'
require 'yaml'
# Shows deltas between the qtrix config and the resque-pool.yml config
# for the various environments.
path = File.join('config','qtrix.yml')
config = YAML.load(File.read(path))
qtrix_queues = Set.new(config.keys)
path = File.join('config','resque_pool.yml')
config = YAML.load(File.read(path))
config.each do |env, config|
next if env == "development"
pool_queues = config.keys.map{|queues| queues.split(",")}.flatten.map(&:to_sym)
delta_queues = qtrix_queues - Set.new(pool_queues)
puts "#{env}: #{delta_queues.to_a.join(", ")}"
end
# Capture the sorted/uniq queues from modified classes.
bundle exec ruby queues_from_class.rb | sort | uniq > queues_from_class.txt
# Capture the sorted/uniq queues from the qtrix config
cat config/qtrix.yml | grep -v '^---' | gawk 'match($0, /:(.+):/, ary) {print ary[1]}' | sort | uniq > queues_from_config.txt
# our diff shows that the qtrix config has every queue from a modified worker class plus the 'default'
# queue catchall
diff queues_from_class.txt queues_from_config.txt
32a33
> default
# Capture classes modified from git status
git status | grep modified | awk '{print $3}' | xargs grep ^class | awk '{print $2}' | sort | uniq > modified_classes.txt
# See that there are 3 classes seen in splunk that have not been modified.
diff modified_classes.txt jobs_seen_in_splunk.txt
8a9
> EmployerStatsExportWorker
25a27
> ScheduledEmployerMethodWorker
26a29
> ScheduledExportsReportWorker
# Verify that these classes belong to the employer_method_jobs queue
egrep -ri "@queue = :employer_method_jobs" lib/workers | awk '{print $1}'
lib/workers/employer_stats_export_worker.rb:
lib/workers/scheduled_employer_method_worker.rb:
lib/workers/scheduled_exports_report_worker.rb:
# Shows that all queues in the qtrix config are accounted for in the resque_pool.yml config.
ruby queues_from_pool_config.rb
> staging:
> production:
> di:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment