Class: OFlow::Inspector::TaskStat

Inherits:
Object
  • Object
show all
Defined in:
lib/oflow/inspector.rb

Constant Summary collapse

STATE_MAP =
{
  Task::STARTING => '^',
  Task::STOPPED => '*',
  Task::RUNNING => ' ',
  Task::CLOSING => 'X',
  Task::BLOCKED => '-',
  Task::STEP => 's',
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(t) ⇒ TaskStat

Returns a new instance of TaskStat.



479
480
481
482
483
484
485
486
487
# File 'lib/oflow/inspector.rb', line 479

def initialize(t)
  @task = t
  @proc_cnt = t.proc_count()
  @activity = 0
  @queued = t.queue_count()
  @name = t.full_name
  @count = @proc_cnt.to_s
  @state = STATE_MAP.fetch(t.state, '?')
end

Instance Attribute Details

#activityObject (readonly)

Returns the value of attribute activity.



465
466
467
# File 'lib/oflow/inspector.rb', line 465

def activity
  @activity
end

#countObject (readonly)

Returns the value of attribute count.



468
469
470
# File 'lib/oflow/inspector.rb', line 468

def count
  @count
end

#nameObject (readonly)

Returns the value of attribute name.



466
467
468
# File 'lib/oflow/inspector.rb', line 466

def name
  @name
end

#proc_cntObject (readonly)

Returns the value of attribute proc_cnt.



467
468
469
# File 'lib/oflow/inspector.rb', line 467

def proc_cnt
  @proc_cnt
end

#queuedObject (readonly)

Returns the value of attribute queued.



464
465
466
# File 'lib/oflow/inspector.rb', line 464

def queued
  @queued
end

#stateObject (readonly)

Returns the value of attribute state.



469
470
471
# File 'lib/oflow/inspector.rb', line 469

def state
  @state
end

#taskObject (readonly)

Returns the value of attribute task.



463
464
465
# File 'lib/oflow/inspector.rb', line 463

def task
  @task
end

Instance Method Details

#refreshObject



489
490
491
492
493
494
495
496
# File 'lib/oflow/inspector.rb', line 489

def refresh()
  cnt = @task.proc_count()
  @activity = cnt - @proc_cnt
  @proc_cnt = cnt
  @queued = @task.queue_count()
  @count = cnt.to_s
  @state = STATE_MAP.fetch(@task.state, '?')
end