Commit d72d47c9 authored by Stan Hu's avatar Stan Hu

Merge branch 'bw-add-background-migration-details' into 'master'

Count and display the number of specific background migration jobs

See merge request gitlab-com/migration!198
parents 8119d7b3 00d63de4
Pipeline #89038 passed with stage
in 19 seconds
...@@ -27,8 +27,12 @@ def cronjob_can_be_disabled(cron_name) ...@@ -27,8 +27,12 @@ def cronjob_can_be_disabled(cron_name)
end end
def handle_named_set(title, named_set) def handle_named_set(title, named_set)
background_migrations = {}
queue_sizes = named_set.each_with_object({}) do |job, hash| queue_sizes = named_set.each_with_object({}) do |job, hash|
hash[job.queue] = (hash[job.queue] || 0) + 1 hash[job.queue] = (hash[job.queue] || 0) + 1
if job.queue == 'background_migration'
background_migrations[job.args[0]] = (background_migrations[job.args[0]] || 0) + 1
end
end end
if !queue_sizes.empty? if !queue_sizes.empty?
...@@ -37,6 +41,9 @@ def handle_named_set(title, named_set) ...@@ -37,6 +41,9 @@ def handle_named_set(title, named_set)
queue_sizes.each do |k,v| queue_sizes.each do |k,v|
status = queue_can_be_purged(k) ? " (purged)" : "" status = queue_can_be_purged(k) ? " (purged)" : ""
puts " #{k}: #{v}#{status}" puts " #{k}: #{v}#{status}"
if k == 'background_migration' && !background_migrations.empty?
background_migrations.each { |klass, count| puts " #{klass}: #{count}"}
end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment