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

Inherits:
ActivityExecution
  • Object
show all
Defined in:
lib/temporalio/client/activity_execution.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

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

Returns Underlying protobuf response.

Returns:



75
76
77
# File 'lib/temporalio/client/activity_execution.rb', line 75

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.



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

def attempt
  @raw_info.attempt
end

#canceled_reasonString?

Returns Reason given when cancellation was requested.

Returns:

  • (String, nil)

    Reason given when cancellation was requested.



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

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.



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

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.



152
153
154
# File 'lib/temporalio/client/activity_execution.rb', line 152

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.



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

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.



120
121
122
# File 'lib/temporalio/client/activity_execution.rb', line 120

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.



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

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.



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

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:



177
178
179
180
181
182
183
184
185
# File 'lib/temporalio/client/activity_execution.rb', line 177

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.



145
146
147
148
149
# File 'lib/temporalio/client/activity_execution.rb', line 145

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.



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

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.



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

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.



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

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.



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

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.



188
189
190
# File 'lib/temporalio/client/activity_execution.rb', line 188

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.



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

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.



86
87
88
89
# File 'lib/temporalio/client/activity_execution.rb', line 86

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.



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

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.



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

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.



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

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.



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

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.



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

def static_summary
  .first
end