Class: RerunTask::Pids

Inherits:
Object
  • Object
show all
Defined in:
lib/rerun_task/pids.rb

Class Method Summary collapse

Class Method Details

.unfinishedObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rerun_task/pids.rb', line 3

def self.unfinished
  res = []
  Dir.glob("#{RerunTask::CONFIG['pid_dir']}/rerun_task/pids/*.pid").each do |file_path|
    args = {}
    File.open(file_path, 'r') do |f|
      args = ProcessFile.parse_file(f.read)
    end
    next if args[:process_name].nil? || args[:pid].nil?
    p = ProcessFile.load_file("#{RerunTask::CONFIG['pid_dir']}/rerun_task/pids", args[:process_name])
    begin
      p.process_exists?
    rescue
      res << p
      next
    end
  end
  res
end