Class: Crontinel::TaskRun
- Inherits:
-
Object
- Object
- Crontinel::TaskRun
- Defined in:
- lib/crontinel.rb
Overview
Represents a single scheduled task / cron job run
Instance Attribute Summary collapse
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#finished_at ⇒ Object
readonly
Returns the value of attribute finished_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(attrs = {}) ⇒ TaskRun
constructor
A new instance of TaskRun.
- #running? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(attrs = {}) ⇒ TaskRun
Returns a new instance of TaskRun.
33 34 35 36 37 38 39 40 41 |
# File 'lib/crontinel.rb', line 33 def initialize(attrs = {}) @id = attrs["id"] @name = attrs["command"] || attrs["name"] @started_at = attrs["started_at"] ? Time.parse(attrs["started_at"]) : nil @finished_at = attrs["finished_at"] ? Time.parse(attrs["finished_at"]) : nil @status = attrs["last_status"] || attrs["status"] || "unknown" @duration_ms = attrs["duration_ms"] @output = attrs["output"] end |
Instance Attribute Details
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def duration_ms @duration_ms end |
#finished_at ⇒ Object (readonly)
Returns the value of attribute finished_at.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def finished_at @finished_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def name @name end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def output @output end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
31 32 33 |
# File 'lib/crontinel.rb', line 31 def status @status end |
Instance Method Details
#failed? ⇒ Boolean
47 48 49 |
# File 'lib/crontinel.rb', line 47 def failed? @status == "failed" end |
#running? ⇒ Boolean
51 52 53 |
# File 'lib/crontinel.rb', line 51 def running? @status == "running" end |
#success? ⇒ Boolean
43 44 45 |
# File 'lib/crontinel.rb', line 43 def success? @status == "completed" || @status == "success" end |