Class: Dtm::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/dtm/schedule.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dtm, schedule_id) ⇒ Schedule

Returns a new instance of Schedule.



18
19
20
21
# File 'lib/dtm/schedule.rb', line 18

def initialize(dtm, schedule_id)
  @dtm = dtm
  @id = schedule_id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



16
17
18
# File 'lib/dtm/schedule.rb', line 16

def id
  @id
end

Class Method Details

.wait_for_completed(schedules, wait_interval) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/dtm/schedule.rb', line 3

def self.wait_for_completed(schedules, wait_interval)
  while !schedules.empty? do
    completed_schedules = schedules.select(&:completed?)

    unless completed_schedules.empty?
      schedules = schedules - completed_schedules
      puts "Remain #{schedules.length}: #{schedules.collect(&:id).join(', ')}"
    end

    sleep(wait_interval) unless schedules.empty?
  end
end

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/dtm/schedule.rb', line 23

def completed?
  @dtm.schedule_status(:schedule_id => @id) {|stdout| stdout.match(/Schedule Status : Completed/)}
end