Class: Temporalio::Client::ActivityExecution::Description

Inherits:
Temporalio::Client::ActivityExecution show all
Defined in:
lib/temporalio/client/activity_execution.rb

Overview

Rich description of a standalone activity execution; returned by Temporalio::Client::ActivityHandle#describe.

WARNING: Standalone Activities are experimental.

Instance Attribute Summary collapse

Attributes inherited from Temporalio::Client::ActivityExecution

#raw_info

Instance Method Summary collapse

Methods inherited from Temporalio::Client::ActivityExecution

#activity_id, #activity_run_id, #activity_type, #close_time, #execution_duration, #schedule_time, #search_attributes, #status, #task_queue

Instance Attribute Details

#raw_descriptionApi::WorkflowService::V1::DescribeActivityExecutionResponse (readonly)

Returns Underlying protobuf response.

Returns:



79
80
81
# File 'lib/temporalio/client/activity_execution.rb', line 79

def raw_description
  @raw_description
end

Instance Method Details

#attemptInteger

Returns Current attempt number. Attempts start at 1 and increment on each retry.

Returns:

  • (Integer)

    Current attempt number. Attempts start at 1 and increment on each retry.



144
145
146
# File 'lib/temporalio/client/activity_execution.rb', line 144

def attempt
  @raw_info.attempt
end

#canceled_reasonString?

Returns Reason given when cancellation was requested.

Returns:

  • (String, nil)

    Reason given when cancellation was requested.



197
198
199
# File 'lib/temporalio/client/activity_execution.rb', line 197

def canceled_reason
  Internal::ProtoUtils.string_or(@raw_info.canceled_reason, nil)
end

#current_retry_intervalFloat?

Returns Time from last attempt failure to next retry, in seconds.

Returns:

  • (Float, nil)

    Time from last attempt failure to next retry, in seconds.



166
167
168
# File 'lib/temporalio/client/activity_execution.rb', line 166

def current_retry_interval
  Internal::ProtoUtils.duration_to_seconds(@raw_info.current_retry_interval)
end

#expiration_timeTime?

Returns Schedule time + schedule-to-close timeout.

Returns:

  • (Time, nil)

    Schedule time + schedule-to-close timeout.



156
157
158
# File 'lib/temporalio/client/activity_execution.rb', line 156

def expiration_time
  Internal::ProtoUtils.timestamp_to_time(@raw_info.expiration_time)
end

#has_heartbeat_details?Boolean

Returns Whether the activity has recorded any heartbeat details.

Returns:

  • (Boolean)

    Whether the activity has recorded any heartbeat details.



116
117
118
# File 'lib/temporalio/client/activity_execution.rb', line 116

def has_heartbeat_details? # rubocop:disable Naming/PredicatePrefix
  !@raw_info.heartbeat_details&.payloads.nil? && !@raw_info.heartbeat_details.payloads.empty?
end

#heartbeat_details(hints: nil) ⇒ Array<Object>

Deserialized last-heartbeat details. Empty when no heartbeat has been recorded.

Parameters:

  • hints (Array<Object>, nil) (defaults to: nil)

    Hints, if any, to assist conversion.

Returns:

  • (Array<Object>)

    Converted details.



124
125
126
# File 'lib/temporalio/client/activity_execution.rb', line 124

def heartbeat_details(hints: nil)
  @data_converter.from_payloads(@raw_info.heartbeat_details, hints:)
end

#heartbeat_timeoutFloat?

Returns Heartbeat timeout in seconds.

Returns:

  • (Float, nil)

    Heartbeat timeout in seconds.



111
112
113
# File 'lib/temporalio/client/activity_execution.rb', line 111

def heartbeat_timeout
  Internal::ProtoUtils.duration_to_seconds(@raw_info.heartbeat_timeout)
end

#last_attempt_complete_timeTime?

Returns Time when the last attempt completed.

Returns:

  • (Time, nil)

    Time when the last attempt completed.



171
172
173
# File 'lib/temporalio/client/activity_execution.rb', line 171

def last_attempt_complete_time
  Internal::ProtoUtils.timestamp_to_time(@raw_info.last_attempt_complete_time)
end

#last_deployment_versionWorkerDeploymentVersion?

Returns Worker deployment version this activity was last dispatched to.

Returns:



181
182
183
184
185
186
187
188
189
# File 'lib/temporalio/client/activity_execution.rb', line 181

def last_deployment_version
  raw = @raw_info.last_deployment_version
  return nil unless raw

  WorkerDeploymentVersion.new(
    deployment_name: raw.deployment_name,
    build_id: raw.build_id
  )
end

#last_failureError::Failure?

Returns Failure of the last failed attempt if any.

Returns:

  • (Error::Failure, nil)

    Failure of the last failed attempt if any.



149
150
151
152
153
# File 'lib/temporalio/client/activity_execution.rb', line 149

def last_failure
  return nil unless @raw_info.last_failure

  @data_converter.from_failure(@raw_info.last_failure)
end

#last_heartbeat_timeTime?

Returns Time the last heartbeat was recorded.

Returns:

  • (Time, nil)

    Time the last heartbeat was recorded.



134
135
136
# File 'lib/temporalio/client/activity_execution.rb', line 134

def last_heartbeat_time
  Internal::ProtoUtils.timestamp_to_time(@raw_info.last_heartbeat_time)
end

#last_started_timeTime?

Returns Time the last attempt started.

Returns:

  • (Time, nil)

    Time the last attempt started.



139
140
141
# File 'lib/temporalio/client/activity_execution.rb', line 139

def last_started_time
  Internal::ProtoUtils.timestamp_to_time(@raw_info.last_started_time)
end

#last_worker_identityString?

Returns Identity of the worker that last picked up this activity.

Returns:

  • (String, nil)

    Identity of the worker that last picked up this activity.



161
162
163
# File 'lib/temporalio/client/activity_execution.rb', line 161

def last_worker_identity
  Internal::ProtoUtils.string_or(@raw_info.last_worker_identity, nil)
end

#next_attempt_schedule_timeTime?

Returns Time when the next attempt will be scheduled.

Returns:

  • (Time, nil)

    Time when the next attempt will be scheduled.



176
177
178
# File 'lib/temporalio/client/activity_execution.rb', line 176

def next_attempt_schedule_time
  Internal::ProtoUtils.timestamp_to_time(@raw_info.next_attempt_schedule_time)
end

#priorityPriority

Returns Priority of this activity.

Returns:

  • (Priority)

    Priority of this activity.



192
193
194
# File 'lib/temporalio/client/activity_execution.rb', line 192

def priority
  Priority._from_proto(@raw_info.priority)
end

#retry_policyRetryPolicy

Returns Retry policy in effect for this activity.

Returns:

  • (RetryPolicy)

    Retry policy in effect for this activity.



129
130
131
# File 'lib/temporalio/client/activity_execution.rb', line 129

def retry_policy
  RetryPolicy._from_proto(@raw_info.retry_policy)
end

#run_statePendingActivityState?

Returns More detailed breakdown of the running state when the activity’s status is RUNNING; nil otherwise.

Returns:

  • (PendingActivityState, nil)

    More detailed breakdown of the running state when the activity’s status is RUNNING; nil otherwise.



90
91
92
93
# File 'lib/temporalio/client/activity_execution.rb', line 90

def run_state
  Internal::ProtoUtils.enum_to_int(Api::Enums::V1::PendingActivityState, @raw_info.run_state,
                                   zero_means_nil: true)
end

#schedule_to_close_timeoutFloat?

Returns Schedule-to-close timeout in seconds.

Returns:

  • (Float, nil)

    Schedule-to-close timeout in seconds.



96
97
98
# File 'lib/temporalio/client/activity_execution.rb', line 96

def schedule_to_close_timeout
  Internal::ProtoUtils.duration_to_seconds(@raw_info.schedule_to_close_timeout)
end

#schedule_to_start_timeoutFloat?

Returns Schedule-to-start timeout in seconds.

Returns:

  • (Float, nil)

    Schedule-to-start timeout in seconds.



101
102
103
# File 'lib/temporalio/client/activity_execution.rb', line 101

def schedule_to_start_timeout
  Internal::ProtoUtils.duration_to_seconds(@raw_info.schedule_to_start_timeout)
end

#start_to_close_timeoutFloat?

Returns Start-to-close timeout in seconds.

Returns:

  • (Float, nil)

    Start-to-close timeout in seconds.



106
107
108
# File 'lib/temporalio/client/activity_execution.rb', line 106

def start_to_close_timeout
  Internal::ProtoUtils.duration_to_seconds(@raw_info.start_to_close_timeout)
end

#static_detailsString?

Returns Static user-metadata details on the activity. May be in markdown format.

Returns:

  • (String, nil)

    Static user-metadata details on the activity. May be in markdown format.



207
208
209
# File 'lib/temporalio/client/activity_execution.rb', line 207

def static_details
  .last
end

#static_summaryString?

Returns Static user-metadata summary on the activity.

Returns:

  • (String, nil)

    Static user-metadata summary on the activity.



202
203
204
# File 'lib/temporalio/client/activity_execution.rb', line 202

def static_summary
  .first
end