Commit 744edfc9 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'remove-references-to-experimental-queue-selector' into 'master'

Remove deprecated `--experimental-queue-selector` flag for Sidekiq

See merge request gitlab-org/gitlab!62697
parents d22ba59d f0dcc2d1
...@@ -47,12 +47,6 @@ module Gitlab ...@@ -47,12 +47,6 @@ module Gitlab
option_parser.parse!(argv) option_parser.parse!(argv)
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
if @queue_selector && @experimental_queue_selector
raise CommandError,
'You cannot specify --queue-selector and --experimental-queue-selector together'
end
worker_metadatas = SidekiqConfig::CliMethods.worker_metadatas(@rails_path) worker_metadatas = SidekiqConfig::CliMethods.worker_metadatas(@rails_path)
worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path) worker_queues = SidekiqConfig::CliMethods.worker_queues(@rails_path)
...@@ -63,8 +57,7 @@ module Gitlab ...@@ -63,8 +57,7 @@ module Gitlab
# as a worker attribute query, and resolve the queues for the # as a worker attribute query, and resolve the queues for the
# queue group using this query. # queue group using this query.
# Simplify with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646 if @queue_selector
if @queue_selector || @experimental_queue_selector
SidekiqConfig::CliMethods.query_queues(queues_or_query_string, worker_metadatas) SidekiqConfig::CliMethods.query_queues(queues_or_query_string, worker_metadatas)
else else
SidekiqConfig::CliMethods.expand_queues(queues_or_query_string.split(','), worker_queues) SidekiqConfig::CliMethods.expand_queues(queues_or_query_string.split(','), worker_queues)
...@@ -194,11 +187,6 @@ module Gitlab ...@@ -194,11 +187,6 @@ module Gitlab
@queue_selector = queue_selector @queue_selector = queue_selector
end end
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
opt.on('--experimental-queue-selector', 'DEPRECATED: use --queue-selector-instead') do |experimental_queue_selector|
@experimental_queue_selector = experimental_queue_selector
end
opt.on('-n', '--negate', 'Run workers for all queues in sidekiq_queues.yml except the given ones') do opt.on('-n', '--negate', 'Run workers for all queues in sidekiq_queues.yml except the given ones') do
@negate_queues = true @negate_queues = true
end end
......
...@@ -10,8 +10,6 @@ RSpec.describe 'bin/sidekiq-cluster' do ...@@ -10,8 +10,6 @@ RSpec.describe 'bin/sidekiq-cluster' do
where(:args, :included, :excluded) do where(:args, :included, :excluded) do
%w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1' %w[--negate cronjob] | '-qdefault,1' | '-qcronjob,1'
%w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1' %w[--queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
%w[--experimental-queue-selector resource_boundary=cpu] | '-qupdate_merge_requests,1' | '-qdefault,1'
end end
with_them do with_them do
...@@ -31,9 +29,7 @@ RSpec.describe 'bin/sidekiq-cluster' do ...@@ -31,9 +29,7 @@ RSpec.describe 'bin/sidekiq-cluster' do
context 'when selecting all queues' do context 'when selecting all queues' do
[ [
%w[*], %w[*],
%w[--queue-selector *], %w[--queue-selector *]
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646
%w[--experimental-queue-selector *]
].each do |args| ].each do |args|
it "runs successfully with `#{args}`", :aggregate_failures do it "runs successfully with `#{args}`", :aggregate_failures do
cmd = %w[bin/sidekiq-cluster --dryrun] + args cmd = %w[bin/sidekiq-cluster --dryrun] + args
......
...@@ -108,114 +108,101 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do ...@@ -108,114 +108,101 @@ RSpec.describe Gitlab::SidekiqCluster::CLI do
end end
end end
# Remove with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646 context "with --queue-selector" do
context 'with --queue-selector and --experimental-queue-selector' do where do
it 'errors' do {
expect(Gitlab::SidekiqCluster).not_to receive(:start) 'memory-bound queues' => {
query: 'resource_boundary=memory',
expect { cli.run(%w(--queue-selector name=foo --experimental-queue-selector name=bar)) } included_queues: %w(project_export),
.to raise_error(described_class::CommandError) excluded_queues: %w(merge)
end },
end 'memory- or CPU-bound queues' => {
query: 'resource_boundary=memory,cpu',
# Simplify with https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/646 included_queues: %w(auto_merge:auto_merge_process project_export),
['--queue-selector', '--experimental-queue-selector'].each do |flag| excluded_queues: %w(merge)
context "with #{flag}" do },
where do 'high urgency CI queues' => {
{ query: 'feature_category=continuous_integration&urgency=high',
'memory-bound queues' => { included_queues: %w(pipeline_cache:expire_job_cache pipeline_cache:expire_pipeline_cache),
query: 'resource_boundary=memory', excluded_queues: %w(merge)
included_queues: %w(project_export), },
excluded_queues: %w(merge) 'CPU-bound high urgency CI queues' => {
}, query: 'feature_category=continuous_integration&urgency=high&resource_boundary=cpu',
'memory- or CPU-bound queues' => { included_queues: %w(pipeline_cache:expire_pipeline_cache),
query: 'resource_boundary=memory,cpu', excluded_queues: %w(pipeline_cache:expire_job_cache merge)
included_queues: %w(auto_merge:auto_merge_process project_export), },
excluded_queues: %w(merge) 'CPU-bound high urgency non-CI queues' => {
}, query: 'feature_category!=continuous_integration&urgency=high&resource_boundary=cpu',
'high urgency CI queues' => { included_queues: %w(new_issue),
query: 'feature_category=continuous_integration&urgency=high', excluded_queues: %w(pipeline_cache:expire_pipeline_cache)
included_queues: %w(pipeline_cache:expire_job_cache pipeline_cache:expire_pipeline_cache), },
excluded_queues: %w(merge) 'CI and SCM queues' => {
}, query: 'feature_category=continuous_integration|feature_category=source_code_management',
'CPU-bound high urgency CI queues' => { included_queues: %w(pipeline_cache:expire_job_cache merge),
query: 'feature_category=continuous_integration&urgency=high&resource_boundary=cpu', excluded_queues: %w(mailers)
included_queues: %w(pipeline_cache:expire_pipeline_cache),
excluded_queues: %w(pipeline_cache:expire_job_cache merge)
},
'CPU-bound high urgency non-CI queues' => {
query: 'feature_category!=continuous_integration&urgency=high&resource_boundary=cpu',
included_queues: %w(new_issue),
excluded_queues: %w(pipeline_cache:expire_pipeline_cache)
},
'CI and SCM queues' => {
query: 'feature_category=continuous_integration|feature_category=source_code_management',
included_queues: %w(pipeline_cache:expire_job_cache merge),
excluded_queues: %w(mailers)
}
} }
end }
end
with_them do
it 'expands queues by attributes' do
expect(Gitlab::SidekiqCluster).to receive(:start) do |queues, opts|
expect(opts).to eq(default_options)
expect(queues.first).to include(*included_queues)
expect(queues.first).not_to include(*excluded_queues)
[] with_them do
end it 'expands queues by attributes' do
expect(Gitlab::SidekiqCluster).to receive(:start) do |queues, opts|
expect(opts).to eq(default_options)
expect(queues.first).to include(*included_queues)
expect(queues.first).not_to include(*excluded_queues)
cli.run(%W(#{flag} #{query})) []
end end
it 'works when negated' do cli.run(%W(--queue-selector #{query}))
expect(Gitlab::SidekiqCluster).to receive(:start) do |queues, opts| end
expect(opts).to eq(default_options)
expect(queues.first).not_to include(*included_queues)
expect(queues.first).to include(*excluded_queues)
[] it 'works when negated' do
end expect(Gitlab::SidekiqCluster).to receive(:start) do |queues, opts|
expect(opts).to eq(default_options)
expect(queues.first).not_to include(*included_queues)
expect(queues.first).to include(*excluded_queues)
cli.run(%W(--negate #{flag} #{query})) []
end end
cli.run(%W(--negate --queue-selector #{query}))
end end
end
it 'expands multiple queue groups correctly' do it 'expands multiple queue groups correctly' do
expect(Gitlab::SidekiqCluster) expect(Gitlab::SidekiqCluster)
.to receive(:start) .to receive(:start)
.with([['chat_notification'], ['project_export']], default_options) .with([['chat_notification'], ['project_export']], default_options)
.and_return([]) .and_return([])
cli.run(%W(#{flag} feature_category=chatops&has_external_dependencies=true resource_boundary=memory&feature_category=importers)) cli.run(%w(--queue-selector feature_category=chatops&has_external_dependencies=true resource_boundary=memory&feature_category=importers))
end end
it 'allows the special * selector' do it 'allows the special * selector' do
worker_queues = %w(foo bar baz) worker_queues = %w(foo bar baz)
expect(Gitlab::SidekiqConfig::CliMethods) expect(Gitlab::SidekiqConfig::CliMethods)
.to receive(:worker_queues).and_return(worker_queues) .to receive(:worker_queues).and_return(worker_queues)
expect(Gitlab::SidekiqCluster) expect(Gitlab::SidekiqCluster)
.to receive(:start).with([worker_queues], default_options) .to receive(:start).with([worker_queues], default_options)
cli.run(%W(#{flag} *)) cli.run(%w(--queue-selector *))
end end
it 'errors when the selector matches no queues' do it 'errors when the selector matches no queues' do
expect(Gitlab::SidekiqCluster).not_to receive(:start) expect(Gitlab::SidekiqCluster).not_to receive(:start)
expect { cli.run(%W(#{flag} has_external_dependencies=true&has_external_dependencies=false)) } expect { cli.run(%w(--queue-selector has_external_dependencies=true&has_external_dependencies=false)) }
.to raise_error(described_class::CommandError) .to raise_error(described_class::CommandError)
end end
it 'errors on an invalid query multiple queue groups correctly' do it 'errors on an invalid query multiple queue groups correctly' do
expect(Gitlab::SidekiqCluster).not_to receive(:start) expect(Gitlab::SidekiqCluster).not_to receive(:start)
expect { cli.run(%W(#{flag} unknown_field=chatops)) } expect { cli.run(%w(--queue-selector unknown_field=chatops)) }
.to raise_error(Gitlab::SidekiqConfig::WorkerMatcher::QueryError) .to raise_error(Gitlab::SidekiqConfig::WorkerMatcher::QueryError)
end
end 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