Class: Temporalio::Client::ActivityExecution::Description
- Inherits:
-
ActivityExecution
- Object
- ActivityExecution
- Temporalio::Client::ActivityExecution::Description
- 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
-
#raw_description ⇒ Api::WorkflowService::V1::DescribeActivityExecutionResponse
readonly
Underlying protobuf response.
Instance Method Summary collapse
-
#attempt ⇒ Integer
Current attempt number.
-
#canceled_reason ⇒ String?
Reason given when cancellation was requested.
-
#current_retry_interval ⇒ Float?
Time from last attempt failure to next retry, in seconds.
-
#expiration_time ⇒ Time?
Schedule time + schedule-to-close timeout.
-
#failure ⇒ Error::Failure?
Failure the activity closed with.
-
#has_heartbeat_details? ⇒ Boolean
Whether heartbeat details are present on this description.
-
#has_input? ⇒ Boolean
Whether the activity's input is present.
-
#has_last_failure? ⇒ Boolean
Whether a last failure is present on this description.
-
#has_result? ⇒ Boolean
Whether the activity closed with a successful result.
-
#heartbeat_details(hints: nil) ⇒ Array<Object>
Deserialized last-heartbeat details.
-
#heartbeat_timeout ⇒ Float?
Heartbeat timeout in seconds.
-
#input(hints: nil) ⇒ Array<Object>
Deserialized activity input, one element per argument.
-
#last_attempt_complete_time ⇒ Time?
Time when the last attempt completed.
-
#last_deployment_version ⇒ WorkerDeploymentVersion?
Worker deployment version this activity was last dispatched to.
-
#last_failure ⇒ Error::Failure?
Failure of the last failed attempt if any.
-
#last_heartbeat_time ⇒ Time?
Time the last heartbeat was recorded.
-
#last_started_time ⇒ Time?
Time the last attempt started.
-
#last_worker_identity ⇒ String?
Identity of the worker that last picked up this activity.
-
#next_attempt_schedule_time ⇒ Time?
Time when the next attempt will be scheduled.
-
#priority ⇒ Priority
Priority of this activity.
-
#result(result_hint: nil) ⇒ Object?
Deserialized result the activity closed with.
-
#retry_policy ⇒ RetryPolicy
Retry policy in effect for this activity.
-
#run_state ⇒ PendingActivityState?
More detailed breakdown of the running state when the activity's status is RUNNING; nil otherwise.
-
#schedule_to_close_timeout ⇒ Float?
Schedule-to-close timeout in seconds.
-
#schedule_to_start_timeout ⇒ Float?
Schedule-to-start timeout in seconds.
-
#start_delay ⇒ Float?
Delay in seconds before the first activity task is made available for dispatch.
-
#start_to_close_timeout ⇒ Float?
Start-to-close timeout in seconds.
-
#static_details ⇒ String?
Static user-metadata details on the activity.
-
#static_summary ⇒ String?
Static user-metadata summary on the activity.
-
#total_heartbeat_count ⇒ Integer
Total number of heartbeats recorded across all attempts.
Instance Attribute Details
#raw_description ⇒ Api::WorkflowService::V1::DescribeActivityExecutionResponse (readonly)
Returns Underlying protobuf response.
85 86 87 |
# File 'lib/temporalio/client/activity_execution.rb', line 85 def raw_description @raw_description end |
Instance Method Details
#attempt ⇒ Integer
Returns Current attempt number. Attempts start at 1 and increment on each retry.
211 212 213 |
# File 'lib/temporalio/client/activity_execution.rb', line 211 def attempt @raw_info.attempt end |
#canceled_reason ⇒ String?
Returns Reason given when cancellation was requested.
278 279 280 |
# File 'lib/temporalio/client/activity_execution.rb', line 278 def canceled_reason Internal::ProtoUtils.string_or(@raw_info.canceled_reason, nil) end |
#current_retry_interval ⇒ Float?
Returns Time from last attempt failure to next retry, in seconds.
247 248 249 |
# File 'lib/temporalio/client/activity_execution.rb', line 247 def current_retry_interval Internal::ProtoUtils.duration_to_seconds(@raw_info.current_retry_interval) end |
#expiration_time ⇒ Time?
Returns Schedule time + schedule-to-close timeout.
237 238 239 |
# File 'lib/temporalio/client/activity_execution.rb', line 237 def expiration_time Internal::ProtoUtils.(@raw_info.expiration_time) end |
#failure ⇒ Error::Failure?
Failure the activity closed with. Nil when the activity did not close with a failure or
when Temporalio::Client::ActivityHandle#describe was called without include_outcome:.
This is the terminal outcome; #last_failure is the failure of the most recent attempt, which may be set while the activity is still retrying.
189 190 191 192 193 |
# File 'lib/temporalio/client/activity_execution.rb', line 189 def failure return nil unless @raw_description.outcome&.value == :failure @data_converter.from_failure(@raw_description.outcome.failure) end |
#has_heartbeat_details? ⇒ Boolean
Whether heartbeat details are present on this description. False when the activity
recorded none, and also when Temporalio::Client::ActivityHandle#describe was called without
include_heartbeat_details:.
132 133 134 |
# File 'lib/temporalio/client/activity_execution.rb', line 132 def has_heartbeat_details? # rubocop:disable Naming/PredicatePrefix !@raw_info.heartbeat_details&.payloads.nil? && !@raw_info.heartbeat_details.payloads.empty? end |
#has_input? ⇒ Boolean
Whether the activity's input is present. False unless Temporalio::Client::ActivityHandle#describe was
called with include_input:.
148 149 150 |
# File 'lib/temporalio/client/activity_execution.rb', line 148 def has_input? # rubocop:disable Naming/PredicatePrefix !@raw_description.input.nil? end |
#has_last_failure? ⇒ Boolean
Whether a last failure is present on this description. False when the activity has no
failed attempt, and also when Temporalio::Client::ActivityHandle#describe was called without
include_last_failure:.
225 226 227 |
# File 'lib/temporalio/client/activity_execution.rb', line 225 def has_last_failure? # rubocop:disable Naming/PredicatePrefix !@raw_info.last_failure.nil? end |
#has_result? ⇒ Boolean
Whether the activity closed with a successful result. False while the activity is still
running, when it closed with a failure, and when Temporalio::Client::ActivityHandle#describe was called
without include_outcome:.
165 166 167 |
# File 'lib/temporalio/client/activity_execution.rb', line 165 def has_result? # rubocop:disable Naming/PredicatePrefix @raw_description.outcome&.value == :result end |
#heartbeat_details(hints: nil) ⇒ Array<Object>
Deserialized last-heartbeat details. Empty when no heartbeat has been recorded.
140 141 142 |
# File 'lib/temporalio/client/activity_execution.rb', line 140 def heartbeat_details(hints: nil) @data_converter.from_payloads(@raw_info.heartbeat_details, hints:) end |
#heartbeat_timeout ⇒ Float?
Returns Heartbeat timeout in seconds.
117 118 119 |
# File 'lib/temporalio/client/activity_execution.rb', line 117 def heartbeat_timeout Internal::ProtoUtils.duration_to_seconds(@raw_info.heartbeat_timeout) end |
#input(hints: nil) ⇒ Array<Object>
Deserialized activity input, one element per argument. Empty when no input is present.
156 157 158 |
# File 'lib/temporalio/client/activity_execution.rb', line 156 def input(hints: nil) @data_converter.from_payloads(@raw_description.input, hints:) end |
#last_attempt_complete_time ⇒ Time?
Returns Time when the last attempt completed.
252 253 254 |
# File 'lib/temporalio/client/activity_execution.rb', line 252 def last_attempt_complete_time Internal::ProtoUtils.(@raw_info.last_attempt_complete_time) end |
#last_deployment_version ⇒ WorkerDeploymentVersion?
Returns Worker deployment version this activity was last dispatched to.
262 263 264 265 266 267 268 269 270 |
# File 'lib/temporalio/client/activity_execution.rb', line 262 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_failure ⇒ Error::Failure?
Returns Failure of the last failed attempt if any.
230 231 232 233 234 |
# File 'lib/temporalio/client/activity_execution.rb', line 230 def last_failure return nil unless @raw_info.last_failure @data_converter.from_failure(@raw_info.last_failure) end |
#last_heartbeat_time ⇒ Time?
Returns Time the last heartbeat was recorded.
201 202 203 |
# File 'lib/temporalio/client/activity_execution.rb', line 201 def last_heartbeat_time Internal::ProtoUtils.(@raw_info.last_heartbeat_time) end |
#last_started_time ⇒ Time?
Returns Time the last attempt started.
206 207 208 |
# File 'lib/temporalio/client/activity_execution.rb', line 206 def last_started_time Internal::ProtoUtils.(@raw_info.last_started_time) end |
#last_worker_identity ⇒ String?
Returns Identity of the worker that last picked up this activity.
242 243 244 |
# File 'lib/temporalio/client/activity_execution.rb', line 242 def last_worker_identity Internal::ProtoUtils.string_or(@raw_info.last_worker_identity, nil) end |
#next_attempt_schedule_time ⇒ Time?
Returns Time when the next attempt will be scheduled.
257 258 259 |
# File 'lib/temporalio/client/activity_execution.rb', line 257 def next_attempt_schedule_time Internal::ProtoUtils.(@raw_info.next_attempt_schedule_time) end |
#priority ⇒ Priority
Returns Priority of this activity.
273 274 275 |
# File 'lib/temporalio/client/activity_execution.rb', line 273 def priority Priority._from_proto(@raw_info.priority) end |
#result(result_hint: nil) ⇒ Object?
Deserialized result the activity closed with. Nil when no result is present (still
running, closed with a failure, or include_outcome: was not requested).
174 175 176 177 178 179 180 |
# File 'lib/temporalio/client/activity_execution.rb', line 174 def result(result_hint: nil) return nil unless has_result? @data_converter.from_payloads( @raw_description.outcome.result, hints: Array(result_hint) ).first end |
#retry_policy ⇒ RetryPolicy
Returns Retry policy in effect for this activity.
196 197 198 |
# File 'lib/temporalio/client/activity_execution.rb', line 196 def retry_policy RetryPolicy._from_proto(@raw_info.retry_policy) end |
#run_state ⇒ PendingActivityState?
Returns More detailed breakdown of the running state when the activity's status is RUNNING; nil otherwise.
96 97 98 99 |
# File 'lib/temporalio/client/activity_execution.rb', line 96 def run_state Internal::ProtoUtils.enum_to_int(Api::Enums::V1::PendingActivityState, @raw_info.run_state, zero_means_nil: true) end |
#schedule_to_close_timeout ⇒ Float?
Returns Schedule-to-close timeout in seconds.
102 103 104 |
# File 'lib/temporalio/client/activity_execution.rb', line 102 def schedule_to_close_timeout Internal::ProtoUtils.duration_to_seconds(@raw_info.schedule_to_close_timeout) end |
#schedule_to_start_timeout ⇒ Float?
Returns Schedule-to-start timeout in seconds.
107 108 109 |
# File 'lib/temporalio/client/activity_execution.rb', line 107 def schedule_to_start_timeout Internal::ProtoUtils.duration_to_seconds(@raw_info.schedule_to_start_timeout) end |
#start_delay ⇒ Float?
Returns Delay in seconds before the first activity task is made available for dispatch. Not applied to retry attempts.
123 124 125 |
# File 'lib/temporalio/client/activity_execution.rb', line 123 def start_delay Internal::ProtoUtils.duration_to_seconds(@raw_info.start_delay) end |
#start_to_close_timeout ⇒ Float?
Returns Start-to-close timeout in seconds.
112 113 114 |
# File 'lib/temporalio/client/activity_execution.rb', line 112 def start_to_close_timeout Internal::ProtoUtils.duration_to_seconds(@raw_info.start_to_close_timeout) end |
#static_details ⇒ String?
Returns Static user-metadata details on the activity. May be in markdown format.
288 289 290 |
# File 'lib/temporalio/client/activity_execution.rb', line 288 def static_details .last end |
#static_summary ⇒ String?
Returns Static user-metadata summary on the activity.
283 284 285 |
# File 'lib/temporalio/client/activity_execution.rb', line 283 def static_summary .first end |
#total_heartbeat_count ⇒ Integer
Returns Total number of heartbeats recorded across all attempts.
216 217 218 |
# File 'lib/temporalio/client/activity_execution.rb', line 216 def total_heartbeat_count @raw_info.total_heartbeat_count end |