Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b6db5a1e
Commit
b6db5a1e
authored
Feb 10, 2020
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow querying queues by name
parent
189f707a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
doc/administration/operations/extra_sidekiq_processes.md
doc/administration/operations/extra_sidekiq_processes.md
+3
-0
lib/gitlab/sidekiq_config/cli_methods.rb
lib/gitlab/sidekiq_config/cli_methods.rb
+11
-16
spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb
spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb
+7
-1
No files found.
doc/administration/operations/extra_sidekiq_processes.md
View file @
b6db5a1e
...
...
@@ -109,6 +109,9 @@ attributes](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/workers/all_q
latency, which also means that its jobs should run quickly. For example, the
`authorized_projects`
queue is used to refresh user permissions, and is
latency sensitive.
-
`name`
- the queue name. The other attributes are typically more useful as
they are more general, but this is available in case a particular queue needs
to be selected.
-
`resource_boundary`
- if the worker is bound by
`cpu`
,
`memory`
, or
`unknown`
. For example, the
`project_export`
queue is memory bound as it has
to load data in memory before saving it for export.
...
...
lib/gitlab/sidekiq_config/cli_methods.rb
View file @
b6db5a1e
...
...
@@ -23,6 +23,14 @@ module Gitlab
QUERY_CONCATENATE_OPERATOR
=
'|'
QUERY_TERM_REGEX
=
%r{^(
\w
+)(!?=)([
\w
|]+)}
.
freeze
QUERY_PREDICATES
=
{
feature_category: :to_sym
,
has_external_dependencies:
lambda
{
|
value
|
value
==
'true'
},
latency_sensitive:
lambda
{
|
value
|
value
==
'true'
},
name: :to_s
,
resource_boundary: :to_sym
}.
freeze
QueryError
=
Class
.
new
(
StandardError
)
InvalidTerm
=
Class
.
new
(
QueryError
)
UnknownOperator
=
Class
.
new
(
QueryError
)
...
...
@@ -102,24 +110,11 @@ module Gitlab
end
def
predicate_factory
(
lhs
,
values
)
to_bool
=
lambda
{
|
value
|
value
==
'true'
}
case
lhs
when
'feature_category'
lambda
{
|
worker
|
values
.
map
(
&
:to_sym
).
include?
(
worker
[
:feature_category
])
}
when
'has_external_dependencies'
lambda
{
|
worker
|
values
.
map
(
&
to_bool
).
include?
(
worker
[
:has_external_dependencies
])
}
values_block
=
QUERY_PREDICATES
[
lhs
.
to_sym
]
when
'latency_sensitive'
lambda
{
|
worker
|
values
.
map
(
&
to_bool
).
include?
(
worker
[
:latency_sensitive
])
}
raise
UnknownPredicate
.
new
(
"Unknown predicate:
#{
lhs
}
"
)
unless
values_block
when
'resource_boundary'
lambda
{
|
worker
|
values
.
map
(
&
:to_sym
).
include?
(
worker
[
:resource_boundary
])
}
else
raise
UnknownPredicate
.
new
(
"Unknown predicate:
#{
lhs
}
"
)
end
lambda
{
|
queue
|
values
.
map
(
&
values_block
).
include?
(
queue
[
lhs
.
to_sym
])
}
end
end
end
...
...
spec/lib/gitlab/sidekiq_config/cli_methods_spec.rb
View file @
b6db5a1e
...
...
@@ -173,6 +173,12 @@ describe Gitlab::SidekiqConfig::CliMethods do
'latency_sensitive=true latency_sensitive=false'
|
%w(a a_2 b c)
'latency_sensitive!=true'
|
%w(a c)
# name
'name=a'
|
%w(a)
'name=a|b'
|
%w(a b)
'name=a|a_2 name=b'
|
%w(a a_2 b)
'name!=a|a_2'
|
%w(b c)
# resource_boundary
'resource_boundary=memory'
|
%w(b c)
'resource_boundary=memory|cpu'
|
%w(a b c)
...
...
@@ -197,7 +203,7 @@ describe Gitlab::SidekiqConfig::CliMethods do
'feature_category="category_a"'
|
described_class
::
InvalidTerm
'feature_category='
|
described_class
::
InvalidTerm
'feature_category~category_a'
|
described_class
::
InvalidTerm
'name=a'
|
described_class
::
UnknownPredicate
'
worker_
name=a'
|
described_class
::
UnknownPredicate
end
with_them
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment