Class: Temporal::Workflow::ExecutionInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/temporal/workflow/execution_info.rb

Constant Summary collapse

RUNNING_STATUS =
:RUNNING
COMPLETED_STATUS =
:COMPLETED
FAILED_STATUS =
:FAILED
CANCELED_STATUS =
:CANCELED
TERMINATED_STATUS =
:TERMINATED
CONTINUED_AS_NEW_STATUS =
:CONTINUED_AS_NEW
TIMED_OUT_STATUS =
:TIMED_OUT
API_STATUS_MAP =
{
  WORKFLOW_EXECUTION_STATUS_RUNNING: RUNNING_STATUS,
  WORKFLOW_EXECUTION_STATUS_COMPLETED: COMPLETED_STATUS,
  WORKFLOW_EXECUTION_STATUS_FAILED: FAILED_STATUS,
  WORKFLOW_EXECUTION_STATUS_CANCELED: CANCELED_STATUS,
  WORKFLOW_EXECUTION_STATUS_TERMINATED: TERMINATED_STATUS,
  WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW: CONTINUED_AS_NEW_STATUS,
  WORKFLOW_EXECUTION_STATUS_TIMED_OUT: TIMED_OUT_STATUS
}.freeze
VALID_STATUSES =
[
  RUNNING_STATUS,
  COMPLETED_STATUS,
  FAILED_STATUS,
  CANCELED_STATUS,
  TERMINATED_STATUS,
  CONTINUED_AS_NEW_STATUS,
  TIMED_OUT_STATUS
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#close_timeObject

Returns the value of attribute close_time

Returns:

  • (Object)

    the current value of close_time



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def close_time
  @close_time
end

#history_lengthObject

Returns the value of attribute history_length

Returns:

  • (Object)

    the current value of history_length



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def history_length
  @history_length
end

#run_idObject

Returns the value of attribute run_id

Returns:

  • (Object)

    the current value of run_id



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def run_id
  @run_id
end

#start_timeObject

Returns the value of attribute start_time

Returns:

  • (Object)

    the current value of start_time



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def status
  @status
end

#workflowObject

Returns the value of attribute workflow

Returns:

  • (Object)

    the current value of workflow



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def workflow
  @workflow
end

#workflow_idObject

Returns the value of attribute workflow_id

Returns:

  • (Object)

    the current value of workflow_id



3
4
5
# File 'lib/temporal/workflow/execution_info.rb', line 3

def workflow_id
  @workflow_id
end

Class Method Details

.generate_from(response) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/temporal/workflow/execution_info.rb', line 32

def self.generate_from(response)
  new(
    workflow: response.type.name,
    workflow_id: response.execution.workflow_id,
    run_id: response.execution.run_id,
    start_time: response.start_time&.to_time,
    close_time: response.close_time&.to_time,
    status: API_STATUS_MAP.fetch(response.status),
    history_length: response.history_length,
  ).freeze
end