Class: Conductor::Http::Models::TaskResult
- Defined in:
- lib/conductor/http/models/task_result.rb
Overview
TaskResult model representing the result of task execution
Constant Summary collapse
- SWAGGER_TYPES =
{ workflow_instance_id: 'String', task_id: 'String', reason_for_incompletion: 'String', callback_after_seconds: 'Integer', worker_id: 'String', status: 'String', output_data: 'Hash<String, Object>', logs: 'Array<TaskExecLog>', external_output_payload_storage_path: 'String', sub_workflow_id: 'String', extend_lease: 'Boolean' }.freeze
- ATTRIBUTE_MAP =
{ workflow_instance_id: :workflowInstanceId, task_id: :taskId, reason_for_incompletion: :reasonForIncompletion, callback_after_seconds: :callbackAfterSeconds, worker_id: :workerId, status: :status, output_data: :outputData, logs: :logs, external_output_payload_storage_path: :externalOutputPayloadStoragePath, sub_workflow_id: :subWorkflowId, extend_lease: :extendLease }.freeze
Instance Attribute Summary collapse
-
#callback_after_seconds ⇒ Object
Returns the value of attribute callback_after_seconds.
-
#extend_lease ⇒ Object
Returns the value of attribute extend_lease.
-
#external_output_payload_storage_path ⇒ Object
Returns the value of attribute external_output_payload_storage_path.
-
#logs ⇒ Object
Returns the value of attribute logs.
-
#output_data ⇒ Object
Returns the value of attribute output_data.
-
#reason_for_incompletion ⇒ Object
Returns the value of attribute reason_for_incompletion.
-
#status ⇒ Object
Returns the value of attribute status.
-
#sub_workflow_id ⇒ Object
Returns the value of attribute sub_workflow_id.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
-
#worker_id ⇒ Object
Returns the value of attribute worker_id.
-
#workflow_instance_id ⇒ Object
Returns the value of attribute workflow_instance_id.
Class Method Summary collapse
-
.complete ⇒ TaskResult
Create a COMPLETED task result.
-
.failed(failure_reason = nil) ⇒ TaskResult
Create a FAILED task result.
-
.failed_with_terminal_error(failure_reason = nil) ⇒ TaskResult
Create a FAILED_WITH_TERMINAL_ERROR task result.
-
.in_progress ⇒ TaskResult
Create an IN_PROGRESS task result.
Instance Method Summary collapse
-
#add_output_data(key, value) ⇒ TaskResult
Add a key-value pair to output_data.
-
#initialize(attributes = {}) ⇒ TaskResult
constructor
Initialize a new TaskResult.
-
#log(log_message) ⇒ TaskResult
Add a log message.
Methods inherited from BaseModel
attribute_map, deserialize_model, deserialize_value, find_model_class, from_hash, from_json, parse_datetime, swagger_types, #to_h, #to_json
Constructor Details
#initialize(attributes = {}) ⇒ TaskResult
Initialize a new TaskResult
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/conductor/http/models/task_result.rb', line 46 def initialize(attributes = {}) return unless attributes.is_a?(Hash) self.workflow_instance_id = attributes[:workflow_instance_id] if attributes.key?(:workflow_instance_id) self.task_id = attributes[:task_id] if attributes.key?(:task_id) self.reason_for_incompletion = attributes[:reason_for_incompletion] if attributes.key?(:reason_for_incompletion) self.callback_after_seconds = attributes[:callback_after_seconds] if attributes.key?(:callback_after_seconds) self.worker_id = attributes[:worker_id] if attributes.key?(:worker_id) self.status = attributes[:status] if attributes.key?(:status) self.output_data = attributes[:output_data] || {} self.logs = attributes[:logs] || [] if attributes.key?(:external_output_payload_storage_path) self.external_output_payload_storage_path = attributes[:external_output_payload_storage_path] end self.sub_workflow_id = attributes[:sub_workflow_id] if attributes.key?(:sub_workflow_id) self.extend_lease = attributes[:extend_lease] || false end |
Instance Attribute Details
#callback_after_seconds ⇒ Object
Returns the value of attribute callback_after_seconds.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def callback_after_seconds @callback_after_seconds end |
#extend_lease ⇒ Object
Returns the value of attribute extend_lease.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def extend_lease @extend_lease end |
#external_output_payload_storage_path ⇒ Object
Returns the value of attribute external_output_payload_storage_path.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def external_output_payload_storage_path @external_output_payload_storage_path end |
#logs ⇒ Object
Returns the value of attribute logs.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def logs @logs end |
#output_data ⇒ Object
Returns the value of attribute output_data.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def output_data @output_data end |
#reason_for_incompletion ⇒ Object
Returns the value of attribute reason_for_incompletion.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def reason_for_incompletion @reason_for_incompletion end |
#status ⇒ Object
Returns the value of attribute status.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def status @status end |
#sub_workflow_id ⇒ Object
Returns the value of attribute sub_workflow_id.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def sub_workflow_id @sub_workflow_id end |
#task_id ⇒ Object
Returns the value of attribute task_id.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def task_id @task_id end |
#worker_id ⇒ Object
Returns the value of attribute worker_id.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def worker_id @worker_id end |
#workflow_instance_id ⇒ Object
Returns the value of attribute workflow_instance_id.
39 40 41 |
# File 'lib/conductor/http/models/task_result.rb', line 39 def workflow_instance_id @workflow_instance_id end |
Class Method Details
.complete ⇒ TaskResult
Create a COMPLETED task result
85 86 87 |
# File 'lib/conductor/http/models/task_result.rb', line 85 def self.complete new(status: TaskResultStatus::COMPLETED) end |
.failed(failure_reason = nil) ⇒ TaskResult
Create a FAILED task result
92 93 94 95 96 |
# File 'lib/conductor/http/models/task_result.rb', line 92 def self.failed(failure_reason = nil) result = new(status: TaskResultStatus::FAILED) result.reason_for_incompletion = failure_reason if failure_reason result end |
.failed_with_terminal_error(failure_reason = nil) ⇒ TaskResult
Create a FAILED_WITH_TERMINAL_ERROR task result
107 108 109 110 111 |
# File 'lib/conductor/http/models/task_result.rb', line 107 def self.failed_with_terminal_error(failure_reason = nil) result = new(status: TaskResultStatus::FAILED_WITH_TERMINAL_ERROR) result.reason_for_incompletion = failure_reason if failure_reason result end |
.in_progress ⇒ TaskResult
Create an IN_PROGRESS task result
100 101 102 |
# File 'lib/conductor/http/models/task_result.rb', line 100 def self.in_progress new(status: TaskResultStatus::IN_PROGRESS) end |
Instance Method Details
#add_output_data(key, value) ⇒ TaskResult
Add a key-value pair to output_data
68 69 70 71 72 |
# File 'lib/conductor/http/models/task_result.rb', line 68 def add_output_data(key, value) @output_data ||= {} @output_data[key] = value self end |
#log(log_message) ⇒ TaskResult
Add a log message
77 78 79 80 81 |
# File 'lib/conductor/http/models/task_result.rb', line 77 def log() @logs ||= [] @logs << self end |