Class: Conductor::Http::Models::Task

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/conductor/http/models/task.rb

Overview

Task model representing a task in a workflow

Constant Summary collapse

SWAGGER_TYPES =
{
  task_type: 'String',
  status: 'String',
  input_data: 'Hash<String, Object>',
  reference_task_name: 'String',
  retry_count: 'Integer',
  seq: 'Integer',
  correlation_id: 'String',
  poll_count: 'Integer',
  task_def_name: 'String',
  scheduled_time: 'Integer',
  start_time: 'Integer',
  end_time: 'Integer',
  update_time: 'Integer',
  start_delay_in_seconds: 'Integer',
  retried_task_id: 'String',
  retried: 'Boolean',
  executed: 'Boolean',
  callback_from_worker: 'Boolean',
  response_timeout_seconds: 'Integer',
  workflow_instance_id: 'String',
  workflow_type: 'String',
  task_id: 'String',
  reason_for_incompletion: 'String',
  callback_after_seconds: 'Integer',
  worker_id: 'String',
  output_data: 'Hash<String, Object>',
  workflow_task: 'WorkflowTask',
  domain: 'String',
  rate_limit_per_frequency: 'Integer',
  rate_limit_frequency_in_seconds: 'Integer',
  external_input_payload_storage_path: 'String',
  external_output_payload_storage_path: 'String',
  workflow_priority: 'Integer',
  execution_name_space: 'String',
  isolation_group_id: 'String',
  iteration: 'Integer',
  sub_workflow_id: 'String',
  subworkflow_changed: 'Boolean',
  parent_task_id: 'String',
  first_start_time: 'Integer',
  loop_over_task: 'Boolean',
  task_definition: 'TaskDef',
  queue_wait_time: 'Integer'
}.freeze
ATTRIBUTE_MAP =
{
  task_type: :taskType,
  status: :status,
  input_data: :inputData,
  reference_task_name: :referenceTaskName,
  retry_count: :retryCount,
  seq: :seq,
  correlation_id: :correlationId,
  poll_count: :pollCount,
  task_def_name: :taskDefName,
  scheduled_time: :scheduledTime,
  start_time: :startTime,
  end_time: :endTime,
  update_time: :updateTime,
  start_delay_in_seconds: :startDelayInSeconds,
  retried_task_id: :retriedTaskId,
  retried: :retried,
  executed: :executed,
  callback_from_worker: :callbackFromWorker,
  response_timeout_seconds: :responseTimeoutSeconds,
  workflow_instance_id: :workflowInstanceId,
  workflow_type: :workflowType,
  task_id: :taskId,
  reason_for_incompletion: :reasonForIncompletion,
  callback_after_seconds: :callbackAfterSeconds,
  worker_id: :workerId,
  output_data: :outputData,
  workflow_task: :workflowTask,
  domain: :domain,
  rate_limit_per_frequency: :rateLimitPerFrequency,
  rate_limit_frequency_in_seconds: :rateLimitFrequencyInSeconds,
  external_input_payload_storage_path: :externalInputPayloadStoragePath,
  external_output_payload_storage_path: :externalOutputPayloadStoragePath,
  workflow_priority: :workflowPriority,
  execution_name_space: :executionNameSpace,
  isolation_group_id: :isolationGroupId,
  iteration: :iteration,
  sub_workflow_id: :subWorkflowId,
  subworkflow_changed: :subworkflowChanged,
  parent_task_id: :parentTaskId,
  first_start_time: :firstStartTime,
  loop_over_task: :loopOverTask,
  task_definition: :taskDefinition,
  queue_wait_time: :queueWaitTime
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = {}) ⇒ Task

Initialize a new Task

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/conductor/http/models/task.rb', line 117

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # Set all attributes from the hash
  SWAGGER_TYPES.each_key do |key|
    send("#{key}=", attributes[key]) if attributes.key?(key)
  end

  # Set default values for collections
  @input_data ||= {}
  @output_data ||= {}
end

Instance Attribute Details

#callback_after_secondsObject

Returns the value of attribute callback_after_seconds.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def callback_after_seconds
  @callback_after_seconds
end

#callback_from_workerObject

Returns the value of attribute callback_from_worker.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def callback_from_worker
  @callback_from_worker
end

#correlation_idObject

Returns the value of attribute correlation_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def correlation_id
  @correlation_id
end

#domainObject

Returns the value of attribute domain.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def domain
  @domain
end

#end_timeObject

Returns the value of attribute end_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def end_time
  @end_time
end

#executedObject

Returns the value of attribute executed.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def executed
  @executed
end

#execution_name_spaceObject

Returns the value of attribute execution_name_space.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def execution_name_space
  @execution_name_space
end

#external_input_payload_storage_pathObject

Returns the value of attribute external_input_payload_storage_path.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def external_input_payload_storage_path
  @external_input_payload_storage_path
end

#external_output_payload_storage_pathObject

Returns the value of attribute external_output_payload_storage_path.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def external_output_payload_storage_path
  @external_output_payload_storage_path
end

#first_start_timeObject

Returns the value of attribute first_start_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def first_start_time
  @first_start_time
end

#input_dataObject

Returns the value of attribute input_data.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def input_data
  @input_data
end

#isolation_group_idObject

Returns the value of attribute isolation_group_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def isolation_group_id
  @isolation_group_id
end

#iterationObject

Returns the value of attribute iteration.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def iteration
  @iteration
end

#loop_over_taskObject

Returns the value of attribute loop_over_task.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def loop_over_task
  @loop_over_task
end

#output_dataObject

Returns the value of attribute output_data.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def output_data
  @output_data
end

#parent_task_idObject

Returns the value of attribute parent_task_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def parent_task_id
  @parent_task_id
end

#poll_countObject

Returns the value of attribute poll_count.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def poll_count
  @poll_count
end

#queue_wait_timeObject

Returns the value of attribute queue_wait_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def queue_wait_time
  @queue_wait_time
end

#rate_limit_frequency_in_secondsObject

Returns the value of attribute rate_limit_frequency_in_seconds.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def rate_limit_frequency_in_seconds
  @rate_limit_frequency_in_seconds
end

#rate_limit_per_frequencyObject

Returns the value of attribute rate_limit_per_frequency.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def rate_limit_per_frequency
  @rate_limit_per_frequency
end

#reason_for_incompletionObject

Returns the value of attribute reason_for_incompletion.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def reason_for_incompletion
  @reason_for_incompletion
end

#reference_task_nameObject

Returns the value of attribute reference_task_name.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def reference_task_name
  @reference_task_name
end

#response_timeout_secondsObject

Returns the value of attribute response_timeout_seconds.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def response_timeout_seconds
  @response_timeout_seconds
end

#retriedObject

Returns the value of attribute retried.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def retried
  @retried
end

#retried_task_idObject

Returns the value of attribute retried_task_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def retried_task_id
  @retried_task_id
end

#retry_countObject

Returns the value of attribute retry_count.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def retry_count
  @retry_count
end

#scheduled_timeObject

Returns the value of attribute scheduled_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def scheduled_time
  @scheduled_time
end

#seqObject

Returns the value of attribute seq.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def seq
  @seq
end

#start_delay_in_secondsObject

Returns the value of attribute start_delay_in_seconds.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def start_delay_in_seconds
  @start_delay_in_seconds
end

#start_timeObject

Returns the value of attribute start_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def status
  @status
end

#sub_workflow_idObject

Returns the value of attribute sub_workflow_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def sub_workflow_id
  @sub_workflow_id
end

#subworkflow_changedObject

Returns the value of attribute subworkflow_changed.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def subworkflow_changed
  @subworkflow_changed
end

#task_def_nameObject

Returns the value of attribute task_def_name.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def task_def_name
  @task_def_name
end

#task_definitionObject

Returns the value of attribute task_definition.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def task_definition
  @task_definition
end

#task_idObject

Returns the value of attribute task_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def task_id
  @task_id
end

#task_typeObject

Returns the value of attribute task_type.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def task_type
  @task_type
end

#update_timeObject

Returns the value of attribute update_time.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def update_time
  @update_time
end

#worker_idObject

Returns the value of attribute worker_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def worker_id
  @worker_id
end

#workflow_instance_idObject

Returns the value of attribute workflow_instance_id.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def workflow_instance_id
  @workflow_instance_id
end

#workflow_priorityObject

Returns the value of attribute workflow_priority.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def workflow_priority
  @workflow_priority
end

#workflow_taskObject

Returns the value of attribute workflow_task.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def workflow_task
  @workflow_task
end

#workflow_typeObject

Returns the value of attribute workflow_type.



102
103
104
# File 'lib/conductor/http/models/task.rb', line 102

def workflow_type
  @workflow_type
end

Instance Method Details

#completed?Boolean

Check if task completed successfully

Returns:

  • (Boolean)

    true if task status is COMPLETED



138
139
140
# File 'lib/conductor/http/models/task.rb', line 138

def completed?
  status == 'COMPLETED'
end

#failed?Boolean

Check if task failed

Returns:

  • (Boolean)

    true if task status is FAILED or FAILED_WITH_TERMINAL_ERROR



144
145
146
# File 'lib/conductor/http/models/task.rb', line 144

def failed?
  %w[FAILED FAILED_WITH_TERMINAL_ERROR].include?(status)
end

#in_progress?Boolean

Check if task is in progress

Returns:

  • (Boolean)

    true if task status is IN_PROGRESS or SCHEDULED



150
151
152
# File 'lib/conductor/http/models/task.rb', line 150

def in_progress?
  %w[IN_PROGRESS SCHEDULED].include?(status)
end

#terminal?Boolean

Check if task is in terminal state

Returns:

  • (Boolean)

    true if task is completed, failed, or cancelled



132
133
134
# File 'lib/conductor/http/models/task.rb', line 132

def terminal?
  %w[COMPLETED FAILED FAILED_WITH_TERMINAL_ERROR CANCELED TIMED_OUT SKIPPED].include?(status)
end