Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions temporalio/lib/temporalio/activity/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Activity
:heartbeat_timeout,
:local?,
:priority,
:retry_policy,
:raw_heartbeat_details,
:schedule_to_close_timeout,
:scheduled_time,
Expand Down Expand Up @@ -42,6 +43,10 @@ module Activity
# @return [Boolean] Whether the activity is a local activity or not.
# @!attribute priority
# @return [Priority] The priority of this activity.
# @!attribute retry_policy
# @return [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.
# @!attribute raw_heartbeat_details
# @return [Array<Converter::RawValue>] Raw details from the last heartbeat of the last attempt. Can use
# {heartbeat_details} to get lazily-converted values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def execute_activity(task_token, defn, start)
payloads = codec.decode(payloads) if codec
payloads.map { |p| Temporalio::Converters::RawValue.new(p) }
end,
retry_policy: (RetryPolicy._from_proto(start.retry_policy) if start.retry_policy),
schedule_to_close_timeout: Internal::ProtoUtils.duration_to_seconds(start.schedule_to_close_timeout),
scheduled_time: Internal::ProtoUtils.timestamp_to_time(start.scheduled_time) || raise, # Never nil
start_to_close_timeout: Internal::ProtoUtils.duration_to_seconds(start.start_to_close_timeout),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def self.default_info
local?: false,
priority: Temporalio::Priority.default,
raw_heartbeat_details: [],
retry_policy: RetryPolicy.new,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Python/.NET you chose to make this None/null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't put much thought to it before but I think non-null is better since it will never be null in practice (except for pre-1.28 servers due to a bug). .Net isn't merged yet, I plan on changing it there too. We might want to fix it in Python too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'm ok with that. I think it might be better to be null than inaccurate, but we're inaccurate with other parts like priority, so all good.

schedule_to_close_timeout: 1.0,
scheduled_time: Time.at(0),
start_to_close_timeout: 1.0,
Expand Down
2 changes: 2 additions & 0 deletions temporalio/sig/temporalio/activity/info.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module Temporalio
attr_reader local?: bool
attr_reader priority: Temporalio::Priority
attr_reader raw_heartbeat_details: Array[Converters::RawValue]
attr_reader retry_policy: RetryPolicy?
attr_reader schedule_to_close_timeout: Float?
attr_reader scheduled_time: Time
attr_reader start_to_close_timeout: Float?
Expand All @@ -29,6 +30,7 @@ module Temporalio
local?: bool,
priority: Temporalio::Priority?,
raw_heartbeat_details: Array[Converters::RawValue],
retry_policy: RetryPolicy?,
schedule_to_close_timeout: Float?,
scheduled_time: Time,
start_to_close_timeout: Float?,
Expand Down
5 changes: 3 additions & 2 deletions temporalio/test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class TestEnvironment

def initialize
# Start workflow env for an existing server if env vars present
if ENV['TEMPORAL_TEST_CLIENT_TARGET_HOST'].blank?
target_host = ENV['TEMPORAL_TEST_CLIENT_TARGET_HOST']
if target_host.nil? || target_host.empty?
@server = Temporalio::Testing::WorkflowEnvironment.start_local(
logger: Logger.new($stdout),
dev_server_extra_args: [
Expand All @@ -162,7 +163,7 @@ def initialize
end
else
client = Temporalio::Client.connect(
ENV.fetch('TEMPORAL_TEST_CLIENT_TARGET_HOST'),
target_host,
ENV['TEMPORAL_TEST_CLIENT_TARGET_NAMESPACE'] || 'default',
logger: Logger.new($stdout)
)
Expand Down
2 changes: 1 addition & 1 deletion temporalio/test/worker_activity_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ def test_info
assert_equal 1, info.attempt
refute_nil info.current_attempt_scheduled_time
assert_equal false, info.local?
refute_nil info.retry_policy
refute_nil info.schedule_to_close_timeout
refute_nil info.scheduled_time
refute_nil info.current_attempt_scheduled_time
refute_nil info.start_to_close_timeout
refute_nil info.started_time
refute_nil info.task_queue
Expand Down
Loading