Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions temporalio/lib/temporalio/client/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'temporalio/api'
require 'temporalio/converters'
require 'temporalio/internal/proto_utils'
require 'temporalio/priority'
require 'temporalio/retry_policy'
require 'temporalio/search_attributes'

Expand Down Expand Up @@ -175,6 +176,7 @@ def _to_proto(data_converter)
:retry_policy,
:memo,
:search_attributes,
:priority,
:arg_hints,
:headers
)
Expand Down Expand Up @@ -209,6 +211,8 @@ def _to_proto(data_converter)
# @return [Hash<String, Object>, nil] Memo for the workflow.
# @!attribute search_attributes
# @return [SearchAttributes, nil] Search attributes for the workflow.
# @!attribute priority
# @return [Priority] Priority of the workflow. This is currently experimental.
# @!attribute arg_hints
# @return [Array<Object>, nil] Converter hints for workflow arguments. This is only user-set (e.g. on create)
# and is not persisted and therefore will not be set when describing a workflow.
Expand Down Expand Up @@ -239,6 +243,7 @@ class << self
# @param retry_policy [RetryPolicy, nil] Retry policy for the workflow.
# @param memo [Hash<String, Object>, nil] Memo for the workflow.
# @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
# @param priority [Priority] Priority of the workflow. This is currently experimental.
# @param headers [Hash<String, Object>, nil] Headers for the workflow.
def new(
workflow,
Expand All @@ -253,6 +258,7 @@ def new(
retry_policy: nil,
memo: nil,
search_attributes: nil,
priority: Priority.default,
arg_hints: nil,
headers: nil
)
Expand All @@ -271,6 +277,7 @@ def new(
retry_policy:,
memo:,
search_attributes:,
priority:,
arg_hints: arg_hints || defn_arg_hints,
headers:
)
Expand All @@ -293,6 +300,7 @@ def self._from_proto(raw_info, data_converter)
retry_policy: raw_info.retry_policy ? RetryPolicy._from_proto(raw_info.retry_policy) : nil,
memo: Internal::ProtoUtils.memo_from_proto(raw_info.memo, data_converter),
search_attributes: SearchAttributes._from_proto(raw_info.search_attributes),
priority: Priority._from_proto(raw_info.priority),
headers: Internal::ProtoUtils.headers_from_proto(raw_info.header, data_converter)
)
end
Expand All @@ -312,6 +320,7 @@ def _to_proto(data_converter)
memo: Internal::ProtoUtils.memo_to_proto(memo, data_converter),
search_attributes: search_attributes&._to_proto,
header: Internal::ProtoUtils.headers_to_proto(headers, data_converter),
priority: priority._to_proto,
user_metadata: Internal::ProtoUtils.to_user_metadata(static_summary, static_details, data_converter)
)
)
Expand Down
4 changes: 3 additions & 1 deletion temporalio/sig/temporalio/client/schedule.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ module Temporalio
attr_reader retry_policy: RetryPolicy?
attr_reader memo: Hash[String, Object?]?
attr_reader search_attributes: SearchAttributes?
attr_reader priority: Priority
attr_reader arg_hints: Array[Object]?
attr_reader headers: Hash[String, Object?]?

Expand All @@ -90,6 +91,7 @@ module Temporalio
?retry_policy: RetryPolicy?,
?memo: Hash[String, Object?]?,
?search_attributes: SearchAttributes?,
?priority: Priority,
?arg_hints: Array[Object]?,
?headers: Hash[String, Object?]?
) -> StartWorkflow
Expand Down Expand Up @@ -332,4 +334,4 @@ module Temporalio
end
end
end
end
end
4 changes: 3 additions & 1 deletion temporalio/test/client_schedule_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_basics # rubocop:disable Metrics/AbcSize
static_summary: 'my-summary',
static_details: 'my-details',
execution_timeout: 1.23,
memo: { 'memokey1' => 'memoval1' }
memo: { 'memokey1' => 'memoval1' },
priority: Temporalio::Priority.new(priority_key: 2, fairness_key: 'tenant-a', fairness_weight: 1.5)
)
schedule = Temporalio::Client::Schedule.new(
action:,
Expand Down Expand Up @@ -79,6 +80,7 @@ def test_basics # rubocop:disable Metrics/AbcSize
assert_equal 'my-details', desc_action.static_details
assert_equal action.execution_timeout, desc_action.execution_timeout
assert_equal({ 'memokey1' => 'memoval1' }, desc_action.memo)
assert_equal action.priority, desc_action.priority
assert_equal({ 'memokey2' => 'memoval2' }, desc.memo)
# We want to test the entire returned spec, policy, and state. But server
# side spec turns the cron into a calendar, so we will replicate in our
Expand Down
Loading