Class: Temporalio::Activity::Info

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/activity/info.rb,
lib/temporalio/activity/info.rb

Overview

Note:

WARNING: This class may have required parameters added to its constructor. Users should not instantiate this class or it may break in incompatible ways.

Information about an activity.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activity_id ⇒ String

Returns ID for the activity.

Returns:

  • (String) —

    ID for the activity.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def activity_id
  @activity_id
end

#activity_run_id ⇒ String?

Returns Run ID for a standalone activity execution. nil for activities scheduled from a workflow.

Returns:

  • (String, nil) —

    Run ID for a standalone activity execution. nil for activities scheduled from a workflow.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def activity_run_id
  @activity_run_id
end

#activity_type ⇒ String

Returns Type name for the activity.

Returns:

  • (String) —

    Type name for the activity.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def activity_type
  @activity_type
end

#attempt ⇒ Integer

Returns Attempt the activity is on. Attempts start at 1 and increment on each retry.

Returns:

  • (Integer) —

    Attempt the activity is on. Attempts start at 1 and increment on each retry.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def attempt
  @attempt
end

#current_attempt_scheduled_time ⇒ Time

Returns When the current attempt was scheduled.

Returns:

  • (Time) —

    When the current attempt was scheduled.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def current_attempt_scheduled_time
  @current_attempt_scheduled_time
end

#heartbeat_timeout ⇒ Float?

Returns Heartbeat timeout set by the caller.

Returns:

  • (Float, nil) —

    Heartbeat timeout set by the caller.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def heartbeat_timeout
  @heartbeat_timeout
end

#local? ⇒ Boolean

Returns Whether the activity is a local activity or not.

Returns:

  • (Boolean) —

    Whether the activity is a local activity or not.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def local?
  @local?
end

#namespace ⇒ String

Returns Namespace this activity is on.

Returns:

  • (String) —

    Namespace this activity is on.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def namespace
  @namespace
end

#priority ⇒ Priority

Returns The priority of this activity.

Returns:

  • (Priority) —

    The priority of this activity.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def priority
  @priority
end

#raw_heartbeat_details ⇒ Array<Converter::RawValue>

Returns Raw details from the last heartbeat of the last attempt. Can use #heartbeat_details to get lazily-converted values.

Returns:

  • (Array<Converter::RawValue>) —

    Raw details from the last heartbeat of the last attempt. Can use #heartbeat_details to get lazily-converted values.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def raw_heartbeat_details
  @raw_heartbeat_details
end

#retry_policy ⇒ RetryPolicy?

Returns Retry policy for the activity. Note that the server may have set a different policy than the one provided when scheduling the activity. If the value is None, it means the server didn't send information about retry policy (e.g. due to old server version), but it may still be defined server-side.

Returns:

  • (RetryPolicy, nil) —

    Retry policy for the activity. Note that the server may have set a different policy than the one provided when scheduling the activity. If the value is None, it means the server didn't send information about retry policy (e.g. due to old server version), but it may still be defined server-side.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def retry_policy
  @retry_policy
end

#schedule_to_close_timeout ⇒ Float?

Returns Schedule to close timeout set by the caller.

Returns:

  • (Float, nil) —

    Schedule to close timeout set by the caller.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def schedule_to_close_timeout
  @schedule_to_close_timeout
end

#scheduled_time ⇒ Time

Returns When the activity was scheduled.

Returns:

  • (Time) —

    When the activity was scheduled.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def scheduled_time
  @scheduled_time
end

#start_to_close_timeout ⇒ Float?

Returns Start to close timeout set by the caller.

Returns:

  • (Float, nil) —

    Start to close timeout set by the caller.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def start_to_close_timeout
  @start_to_close_timeout
end

#started_time ⇒ Time

Returns When the activity started.

Returns:

  • (Time) —

    When the activity started.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def started_time
  @started_time
end

#task_queue ⇒ String

Returns Task queue this activity is on.

Returns:

  • (String) —

    Task queue this activity is on.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def task_queue
  @task_queue
end

#task_token ⇒ String

Returns Task token uniquely identifying this activity. Note, this is a ASCII-8BIT encoded string, not a UTF-8 encoded string nor a valid UTF-8 string.

Returns:

  • (String) —

    Task token uniquely identifying this activity. Note, this is a ASCII-8BIT encoded string, not a UTF-8 encoded string nor a valid UTF-8 string.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def task_token
  @task_token
end

#workflow_id ⇒ String?

Returns Workflow ID that started this activity. nil for standalone activities.

Returns:

  • (String, nil) —

    Workflow ID that started this activity. nil for standalone activities.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def workflow_id
  @workflow_id
end

#workflow_namespace ⇒ String?

Deprecated.

Use #namespace instead.

Returns Namespace of the workflow that scheduled this activity. Nil for standalone activities. Prefer #namespace, which is always set.

Returns:

  • (String, nil) —

    Namespace of the workflow that scheduled this activity. Nil for standalone activities. Prefer #namespace, which is always set.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def workflow_namespace
  @workflow_namespace
end

#workflow_run_id ⇒ String?

Returns Workflow run ID that started this activity. nil for standalone activities.

Returns:

  • (String, nil) —

    Workflow run ID that started this activity. nil for standalone activities.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def workflow_run_id
  @workflow_run_id
end

#workflow_type ⇒ String?

Returns Workflow type name that started this activity. nil for standalone activities.

Returns:

  • (String, nil) —

    Workflow type name that started this activity. nil for standalone activities.



85
86
87
# File 'lib/temporalio/activity/info.rb', line 85

def workflow_type
  @workflow_type
end

Instance Method Details

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

Convert raw heartbeat details into Ruby types.

Note, this live-converts every invocation.

Parameters:

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

    Hints, if any, to assist conversion.

Returns:

  • (Array<Object>) —

    Converted details.



97
98
99
100
101
102
103
# File 'lib/temporalio/activity/info.rb', line 97

def heartbeat_details(hints: nil)
  Internal::ProtoUtils.convert_from_payload_array(
    Context.current.payload_converter,
    raw_heartbeat_details.map(&:payload),
    hints:
  )
end

#in_workflow? ⇒ Boolean

Returns True if this activity was scheduled by a workflow execution; false for standalone activities.

Returns:

  • (Boolean) —

    True if this activity was scheduled by a workflow execution; false for standalone activities.



87
88
89
# File 'lib/temporalio/activity/info.rb', line 87

def in_workflow?
  !workflow_id.nil?
end