class Bosh::Director::EventLog::Stage

Public Class Methods

new(event_log, name, tags, total) click to toggle source
# File lib/bosh/director/event_log.rb, line 82
def initialize(event_log, name, tags, total)
  @event_log = event_log
  @name = name
  @tags = tags
  @index = 0
  @total = total
  @index_lock = Mutex.new
end

Public Instance Methods

advance_and_track(task_name, &blk) click to toggle source
# File lib/bosh/director/event_log.rb, line 91
def advance_and_track(task_name, &blk)
  task = @index_lock.synchronize do
    @index += 1
    Task.new(self, task_name, @index)
  end

  task.start
  begin
    blk.call(task) if blk
  rescue => e
    task.failed(e.to_s)
    raise
  end
  task.finish
end
log_entry(entry) click to toggle source
# File lib/bosh/director/event_log.rb, line 107
def log_entry(entry)
  @event_log.log_entry({
    :time => Time.now.to_i,
    :stage => @name,
    :tags => @tags,
    :total => @total,
  }.merge(entry))
end