debian-mirror-gitlab/app/helpers/sidekiq_helper.rb

16 lines
369 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
module SidekiqHelper
2018-03-17 18:26:18 +05:30
SIDEKIQ_PS_REGEXP = %r{\A
2016-09-29 09:46:39 +05:30
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
2018-03-17 18:26:18 +05:30
(?<state>[DIEKNRSTVWXZNLpsl\+<>/\d]+)\s+
2017-08-17 22:00:37 +05:30
(?<start>.+?)\s+
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
2018-03-17 18:26:18 +05:30
\z}x
2016-09-29 09:46:39 +05:30
def parse_sidekiq_ps(line)
2017-08-17 22:00:37 +05:30
match = line.strip.match(SIDEKIQ_PS_REGEXP)
match ? match[1..6] : Array.new(6, '?')
2016-09-29 09:46:39 +05:30
end
end