BigW Consortium Gitlab

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

11 12 13 14 15
  def parse_sidekiq_ps(line)
    match = line.match(SIDEKIQ_PS_REGEXP)
    if match
      match[1..6]
    else
Pascal Betz committed
16
      %w[? ? ? ? ? ?]
17 18 19
    end
  end
end