BigW Consortium Gitlab

sidekiq_helper.rb 368 Bytes
Newer Older
1
module SidekiqHelper
Pascal Betz committed
2
  SIDEKIQ_PS_REGEXP = /\A
Pascal Betz committed
3 4 5
    (?<pid>\d+)\s+
    (?<cpu>[\d\.,]+)\s+
    (?<mem>[\d\.,]+)\s+
6 7 8
    (?<state>[DIEKNRSTVWXZNLpsl\+<>\/\d]+)\s+
    (?<start>.+?)\s+
    (?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
Pascal Betz committed
9
    \z/x
Pascal Betz committed
10

11
  def parse_sidekiq_ps(line)
12 13
    match = line.strip.match(SIDEKIQ_PS_REGEXP)
    match ? match[1..6] : Array.new(6, '?')
14 15
  end
end