Class: Pvectl::Models::TaskEntry
- Defined in:
- lib/pvectl/models/task_entry.rb
Overview
Represents an entry in a node’s task list.
Each entry corresponds to an asynchronous operation (start, stop, migrate, backup, etc.) performed on a resource. Returned by GET /nodes/#node/tasks endpoint.
Instance Attribute Summary collapse
-
#endtime ⇒ Object
readonly
Returns the value of attribute endtime.
-
#exitstatus ⇒ Object
readonly
Returns the value of attribute exitstatus.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#pstart ⇒ Object
readonly
Returns the value of attribute pstart.
-
#starttime ⇒ Object
readonly
Returns the value of attribute starttime.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#upid ⇒ Object
readonly
Returns the value of attribute upid.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #completed? ⇒ Boolean
- #duration ⇒ Object
- #failed? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ TaskEntry
constructor
A new instance of TaskEntry.
- #successful? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ TaskEntry
Returns a new instance of TaskEntry.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pvectl/models/task_entry.rb', line 19 def initialize(attrs = {}) super(attrs) @upid = @attributes[:upid] @node = @attributes[:node] @type = @attributes[:type] @status = @attributes[:status] @exitstatus = @attributes[:exitstatus] @starttime = @attributes[:starttime] @endtime = @attributes[:endtime] @user = @attributes[:user] @id = @attributes[:id] @pid = @attributes[:pid] @pstart = @attributes[:pstart] end |
Instance Attribute Details
#endtime ⇒ Object (readonly)
Returns the value of attribute endtime.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def endtime @endtime end |
#exitstatus ⇒ Object (readonly)
Returns the value of attribute exitstatus.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def exitstatus @exitstatus end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def id @id end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def node @node end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def pid @pid end |
#pstart ⇒ Object (readonly)
Returns the value of attribute pstart.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def pstart @pstart end |
#starttime ⇒ Object (readonly)
Returns the value of attribute starttime.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def starttime @starttime end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def type @type end |
#upid ⇒ Object (readonly)
Returns the value of attribute upid.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def upid @upid end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
16 17 18 |
# File 'lib/pvectl/models/task_entry.rb', line 16 def user @user end |
Instance Method Details
#completed? ⇒ Boolean
42 43 44 |
# File 'lib/pvectl/models/task_entry.rb', line 42 def completed? status != "running" end |
#duration ⇒ Object
46 47 48 49 |
# File 'lib/pvectl/models/task_entry.rb', line 46 def duration return nil unless endtime && starttime endtime - starttime end |
#failed? ⇒ Boolean
38 39 40 |
# File 'lib/pvectl/models/task_entry.rb', line 38 def failed? completed? && exitstatus != "OK" end |
#successful? ⇒ Boolean
34 35 36 |
# File 'lib/pvectl/models/task_entry.rb', line 34 def successful? completed? && exitstatus == "OK" end |