Class: Conductor::Http::Models::Workflow

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

Overview

Workflow execution model representing a running or completed workflow instance

Constant Summary collapse

SWAGGER_TYPES =
{
  workflow_id: 'String',
  parent_workflow_id: 'String',
  parent_workflow_task_id: 'String',
  correlation_id: 'String',
  workflow_name: 'String',
  workflow_version: 'Integer',
  workflow_definition: 'WorkflowDef',
  status: 'String',
  input: 'Hash<String, Object>',
  output: 'Hash<String, Object>',
  tasks: 'Array<Task>',
  start_time: 'Integer',
  end_time: 'Integer',
  update_time: 'Integer',
  variables: 'Hash<String, Object>',
  external_input_payload_storage_path: 'String',
  external_output_payload_storage_path: 'String',
  priority: 'Integer',
  task_to_domain: 'Hash<String, String>',
  failed_reference_task_names: 'Array<String>',
  reason_for_incompletion: 'String',
  owner_app: 'String',
  created_by: 'String',
  event: 'String',
  last_retried_time: 'Integer'
}.freeze
ATTRIBUTE_MAP =
{
  workflow_id: :workflowId,
  parent_workflow_id: :parentWorkflowId,
  parent_workflow_task_id: :parentWorkflowTaskId,
  correlation_id: :correlationId,
  workflow_name: :workflowName,
  workflow_version: :workflowVersion,
  workflow_definition: :workflowDefinition,
  status: :status,
  input: :input,
  output: :output,
  tasks: :tasks,
  start_time: :startTime,
  end_time: :endTime,
  update_time: :updateTime,
  variables: :variables,
  external_input_payload_storage_path: :externalInputPayloadStoragePath,
  external_output_payload_storage_path: :externalOutputPayloadStoragePath,
  priority: :priority,
  task_to_domain: :taskToDomain,
  failed_reference_task_names: :failedReferenceTaskNames,
  reason_for_incompletion: :reasonForIncompletion,
  owner_app: :ownerApp,
  created_by: :createdBy,
  event: :event,
  last_retried_time: :lastRetriedTime
}.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(params = {}) ⇒ Workflow

Returns a new instance of Workflow.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/conductor/http/models/workflow.rb', line 74

def initialize(params = {})
  @workflow_id = params[:workflow_id]
  @parent_workflow_id = params[:parent_workflow_id]
  @parent_workflow_task_id = params[:parent_workflow_task_id]
  @correlation_id = params[:correlation_id]
  @workflow_name = params[:workflow_name]
  @workflow_version = params[:workflow_version]
  @workflow_definition = params[:workflow_definition]
  @status = params[:status]
  @input = params[:input] || {}
  @output = params[:output] || {}
  @tasks = params[:tasks] || []
  @start_time = params[:start_time]
  @end_time = params[:end_time]
  @update_time = params[:update_time]
  @variables = params[:variables] || {}
  @external_input_payload_storage_path = params[:external_input_payload_storage_path]
  @external_output_payload_storage_path = params[:external_output_payload_storage_path]
  @priority = params[:priority]
  @task_to_domain = params[:task_to_domain]
  @failed_reference_task_names = params[:failed_reference_task_names] || []
  @reason_for_incompletion = params[:reason_for_incompletion]
  @owner_app = params[:owner_app]
  @created_by = params[:created_by]
  @event = params[:event]
  @last_retried_time = params[:last_retried_time]
end

Instance Attribute Details

#correlation_idObject

Returns the value of attribute correlation_id.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def correlation_id
  @correlation_id
end

#created_byObject

Returns the value of attribute created_by.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def created_by
  @created_by
end

#end_timeObject

Returns the value of attribute end_time.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def end_time
  @end_time
end

#eventObject

Returns the value of attribute event.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def event
  @event
end

#external_input_payload_storage_pathObject

Returns the value of attribute external_input_payload_storage_path.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

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.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def external_output_payload_storage_path
  @external_output_payload_storage_path
end

#failed_reference_task_namesObject

Returns the value of attribute failed_reference_task_names.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def failed_reference_task_names
  @failed_reference_task_names
end

#inputObject

Returns the value of attribute input.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def input
  @input
end

#last_retried_timeObject

Returns the value of attribute last_retried_time.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def last_retried_time
  @last_retried_time
end

#outputObject

Returns the value of attribute output.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def output
  @output
end

#owner_appObject

Returns the value of attribute owner_app.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def owner_app
  @owner_app
end

#parent_workflow_idObject

Returns the value of attribute parent_workflow_id.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def parent_workflow_id
  @parent_workflow_id
end

#parent_workflow_task_idObject

Returns the value of attribute parent_workflow_task_id.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def parent_workflow_task_id
  @parent_workflow_task_id
end

#priorityObject

Returns the value of attribute priority.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def priority
  @priority
end

#reason_for_incompletionObject

Returns the value of attribute reason_for_incompletion.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def reason_for_incompletion
  @reason_for_incompletion
end

#start_timeObject

Returns the value of attribute start_time.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def status
  @status
end

#task_to_domainObject

Returns the value of attribute task_to_domain.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def task_to_domain
  @task_to_domain
end

#tasksObject

Returns the value of attribute tasks.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def tasks
  @tasks
end

#update_timeObject

Returns the value of attribute update_time.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def update_time
  @update_time
end

#variablesObject

Returns the value of attribute variables.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def variables
  @variables
end

#workflow_definitionObject

Returns the value of attribute workflow_definition.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def workflow_definition
  @workflow_definition
end

#workflow_idObject

Returns the value of attribute workflow_id.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def workflow_id
  @workflow_id
end

#workflow_nameObject

Returns the value of attribute workflow_name.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def workflow_name
  @workflow_name
end

#workflow_versionObject

Returns the value of attribute workflow_version.



64
65
66
# File 'lib/conductor/http/models/workflow.rb', line 64

def workflow_version
  @workflow_version
end

Instance Method Details

#completed?Boolean

Check if workflow completed successfully

Returns:

  • (Boolean)


110
111
112
# File 'lib/conductor/http/models/workflow.rb', line 110

def completed?
  status == WorkflowStatusConstants::COMPLETED
end

#failed?Boolean

Check if workflow failed

Returns:

  • (Boolean)


116
117
118
# File 'lib/conductor/http/models/workflow.rb', line 116

def failed?
  status == WorkflowStatusConstants::FAILED
end

#paused?Boolean

Check if workflow is paused

Returns:

  • (Boolean)


128
129
130
# File 'lib/conductor/http/models/workflow.rb', line 128

def paused?
  status == WorkflowStatusConstants::PAUSED
end

#running?Boolean

Check if workflow is running

Returns:

  • (Boolean)


122
123
124
# File 'lib/conductor/http/models/workflow.rb', line 122

def running?
  status == WorkflowStatusConstants::RUNNING
end

#task_by_ref(ref_name) ⇒ Task?

Get a task by reference name

Parameters:

  • ref_name (String)

    Task reference name

Returns:



135
136
137
# File 'lib/conductor/http/models/workflow.rb', line 135

def task_by_ref(ref_name)
  tasks&.find { |t| t.reference_task_name == ref_name }
end

#terminal?Boolean

Check if workflow is in terminal state

Returns:

  • (Boolean)


104
105
106
# File 'lib/conductor/http/models/workflow.rb', line 104

def terminal?
  WorkflowStatusConstants.terminal?(status)
end