#376: updated priority of queues
This commit is contained in:
parent
552e36cf72
commit
44ac1056ab
|
@ -1,5 +1,5 @@
|
|||
class BuildListsPublishTaskManagerJob
|
||||
@queue = :hook
|
||||
@queue = :middle
|
||||
|
||||
def self.perform
|
||||
AbfWorker::BuildListsPublishTaskManager.new.run
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BuildListsQueuesMonitoringJob
|
||||
@queue = :hook
|
||||
@queue = :middle
|
||||
|
||||
def self.perform
|
||||
Redis.current.smembers('resque:queues').each do |key|
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class CleanApiDefenderStatisticsJob
|
||||
@queue = :clone_build
|
||||
@queue = :low
|
||||
|
||||
def self.perform
|
||||
deadline = Date.today - 1.month
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class CleanRpmBuildNodeJob
|
||||
@queue = :hook
|
||||
@queue = :middle
|
||||
|
||||
def self.perform
|
||||
RpmBuildNode.all.each do |n|
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class RestartNodesJob
|
||||
@queue = :hook
|
||||
@queue = :low
|
||||
|
||||
def self.perform
|
||||
available_nodes = RpmBuildNode.all.map{ |n| n.user_id }.compact.uniq
|
||||
|
|
|
@ -259,8 +259,8 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
later :publish, queue: :clone_build
|
||||
later :add_job_to_abf_worker_queue, queue: :clone_build
|
||||
later :publish, queue: :middle
|
||||
later :add_job_to_abf_worker_queue, queue: :middle
|
||||
|
||||
HUMAN_CONTAINER_STATUSES = { WAITING_FOR_RESPONSE => :waiting_for_publish,
|
||||
BUILD_PUBLISHED => :container_published,
|
||||
|
@ -572,7 +572,7 @@ class BuildList < ActiveRecord::Base
|
|||
def delayed_add_job_to_abf_worker_queue(*args)
|
||||
restart_job if status == BUILD_PENDING
|
||||
end
|
||||
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :clone_build
|
||||
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :middle
|
||||
|
||||
protected
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module FileStoreClean
|
|||
destroy_files_from_file_store if Rails.env.production?
|
||||
super
|
||||
end
|
||||
later :destroy, queue: :clone_build
|
||||
later :destroy, queue: :middle
|
||||
|
||||
def sha1_of_file_store_files
|
||||
raise NotImplementedError, "You should implement this method"
|
||||
|
@ -31,7 +31,7 @@ module FileStoreClean
|
|||
def later_destroy_files_from_file_store(args)
|
||||
destroy_files_from_file_store(args)
|
||||
end
|
||||
later :later_destroy_files_from_file_store, queue: :clone_build
|
||||
later :later_destroy_files_from_file_store, queue: :middle
|
||||
end
|
||||
|
||||
def self.file_exist_on_file_store?(sha1)
|
||||
|
|
|
@ -59,7 +59,7 @@ class MassBuild < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
later :build_all, queue: :clone_build
|
||||
later :build_all, queue: :low
|
||||
|
||||
def generate_failed_builds_list
|
||||
generate_list BuildList::BUILD_ERROR
|
||||
|
@ -75,17 +75,17 @@ class MassBuild < ActiveRecord::Base
|
|||
bl.cancel
|
||||
end
|
||||
end
|
||||
later :cancel_all, queue: :clone_build
|
||||
later :cancel_all, queue: :low
|
||||
|
||||
def publish_success_builds(user)
|
||||
publish user, BuildList::SUCCESS, BuildList::FAILED_PUBLISH
|
||||
end
|
||||
later :publish_success_builds, queue: :clone_build
|
||||
later :publish_success_builds, queue: :low
|
||||
|
||||
def publish_test_failed_builds(user)
|
||||
publish user, BuildList::TESTS_FAILED
|
||||
end
|
||||
later :publish_test_failed_builds, queue: :clone_build
|
||||
later :publish_test_failed_builds, queue: :low
|
||||
|
||||
COUNT_STATUSES.each do |stat|
|
||||
stat_count = "#{stat}_count"
|
||||
|
|
|
@ -205,7 +205,7 @@ class Platform < ActiveRecord::Base
|
|||
def destroy
|
||||
with_skip {super} # avoid cascade XML RPC requests
|
||||
end
|
||||
later :destroy, queue: :clone_build
|
||||
later :destroy, queue: :low
|
||||
|
||||
def default_host
|
||||
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
|
||||
|
@ -274,7 +274,7 @@ class Platform < ActiveRecord::Base
|
|||
def fs_clone(old_name = parent.name, new_name = name)
|
||||
FileUtils.cp_r "#{parent.path}/repository", path
|
||||
end
|
||||
later :fs_clone, queue: :clone_build
|
||||
later :fs_clone, queue: :low
|
||||
|
||||
def freeze_platform_and_update_repos
|
||||
if released_changed? && released == true
|
||||
|
|
|
@ -417,7 +417,7 @@ class Project < ActiveRecord::Base
|
|||
PullRequest.where(from_project_id: id).each{ |p| p.update_relations(old_name) }
|
||||
pull_requests.where('from_project_id != to_project_id').each(&:update_relations)
|
||||
end
|
||||
later :update_path_to_project, queue: :clone_build
|
||||
later :update_path_to_project, queue: :middle
|
||||
|
||||
def check_default_branch
|
||||
if self.repo.branches.count > 0 && self.repo.branches.map(&:name).exclude?(self.default_branch)
|
||||
|
|
|
@ -57,7 +57,7 @@ class PullRequest < ActiveRecord::Base
|
|||
system 'git', 'remote', 'set-url', 'head', from_project.path if cross_pull?
|
||||
end
|
||||
end
|
||||
later :update_relations, queue: :clone_build
|
||||
later :update_relations, queue: :middle
|
||||
|
||||
def cross_pull?
|
||||
from_project_id != to_project_id
|
||||
|
|
|
@ -59,8 +59,7 @@ class Repository < ActiveRecord::Base
|
|||
from.projects.find_each {|p| self.projects << p}
|
||||
end
|
||||
end
|
||||
later :clone_relations, loner: true, queue: :clone_build
|
||||
|
||||
later :clone_relations, loner: true, queue: :low
|
||||
def add_projects(list, user)
|
||||
current_ability = Ability.new(user)
|
||||
list.lines.each do |line|
|
||||
|
@ -75,7 +74,7 @@ class Repository < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
later :add_projects, queue: :clone_build
|
||||
later :add_projects, queue: :middle
|
||||
|
||||
def remove_projects(list)
|
||||
list.lines.each do |name|
|
||||
|
@ -87,7 +86,7 @@ class Repository < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
later :remove_projects, queue: :clone_build
|
||||
later :remove_projects, queue: :middle
|
||||
|
||||
def full_clone(attrs = {})
|
||||
base_clone(attrs).tap do |c|
|
||||
|
@ -148,7 +147,7 @@ class Repository < ActiveRecord::Base
|
|||
def destroy
|
||||
with_skip {super} # avoid cascade XML RPC requests
|
||||
end
|
||||
later :destroy, queue: :clone_build
|
||||
later :destroy, queue: :low
|
||||
|
||||
def self.custom_sort(repos)
|
||||
repos.select{ |r| SORT.keys.include?(r.name) }.sort{ |a,b| SORT[a.name] <=> SORT[b.name] } | repos.sort_by(&:name)
|
||||
|
|
|
@ -2,33 +2,33 @@ clean_rpm_build_nodes:
|
|||
every:
|
||||
- '1m'
|
||||
class: 'CleanRpmBuildNodeJob'
|
||||
queue: hook
|
||||
queue: middle
|
||||
description: 'Cleans RPM build nodes'
|
||||
|
||||
build_lists_publish_task_manager:
|
||||
every:
|
||||
- '3m'
|
||||
class: 'BuildListsPublishTaskManagerJob'
|
||||
queue: hook
|
||||
queue: middle
|
||||
description: 'Creates tasks for publishing'
|
||||
|
||||
build_lists_queues_monitoring:
|
||||
every:
|
||||
- '1m'
|
||||
class: 'BuildListsQueuesMonitoringJob'
|
||||
queue: hook
|
||||
queue: middle
|
||||
description: 'Monitoring for "user/mass-build" queues'
|
||||
|
||||
clean_api_defender_statistics:
|
||||
every:
|
||||
- '1d'
|
||||
class: 'CleanApiDefenderStatisticsJob'
|
||||
queue: clone_build
|
||||
queue: low
|
||||
description: 'Cleans ApiDefender statistics'
|
||||
|
||||
restart_nodes:
|
||||
every:
|
||||
- '5m'
|
||||
class: 'RestartNodesJob'
|
||||
queue: hook
|
||||
queue: low
|
||||
description: 'Restarts unavailable nodes'
|
|
@ -32,9 +32,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|||
:fork_import,
|
||||
:hook,
|
||||
:clone_build,
|
||||
:middle,
|
||||
:notification
|
||||
].join(',')
|
||||
run "cd #{fetch :current_path} && COUNT=#{workers_count} QUEUE=#{queue} #{rails_env} BACKGROUND=yes bundle exec rake resque:workers"
|
||||
run "cd #{fetch :current_path} && COUNT=#{workers_count - 1} QUEUE=#{queue} INTERVAL=0.1 #{rails_env} BACKGROUND=yes bundle exec rake resque:workers"
|
||||
run "cd #{fetch :current_path} && COUNT=1 QUEUE=low #{rails_env} BACKGROUND=yes bundle exec rake resque:workers"
|
||||
end
|
||||
|
||||
def remote_file_exists?(full_path)
|
||||
|
|
Loading…
Reference in New Issue