Class: Runciter::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/runciter/run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, task, opts = {}) ⇒ Run

Returns a new instance of Run.



7
8
9
10
11
12
13
14
# File 'lib/runciter/run.rb', line 7

def initialize(app, task, opts = {})
  @app, @task = app, task
  @opts = opts
  @opts[:heartbeat_interval] ||= 30

  register!
  run_heartbeat_thread!
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/runciter/run.rb', line 5

def id
  @id
end

Instance Method Details

#die!(e) ⇒ Object



29
30
31
32
33
34
# File 'lib/runciter/run.rb', line 29

def die!(e)
  @app.api[:runs].die(@task.id, @id, [e.message, e.backtrace.join("\n")].join("\n"))
  @heart.terminate
  rescue
    warn $!
end

#finish!Object



22
23
24
25
26
27
# File 'lib/runciter/run.rb', line 22

def finish!
  @app.api[:runs].finish(@task.id, @id)
  @heart.terminate
  rescue
    warn $!
end

#step!(num = 1) ⇒ Object



16
17
18
19
20
# File 'lib/runciter/run.rb', line 16

def step!(num = 1)
  @app.api[:runs].incr_step(@task.id, @id, num)
  rescue
    warn $!
end