-
Notifications
You must be signed in to change notification settings - Fork 15
Priority annotations #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Priority annotations #274
Conversation
@@ -38,6 +39,8 @@ module Activity | |||
# @return [Float, nil] Heartbeat timeout set by the caller. | |||
# @!attribute local? | |||
# @return [Boolean] Whether the activity is a local activity or not. | |||
# @!attribute priority | |||
# @return [Priority, nil] The priority of this activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this ever be nil
? (same for workflow info)
:priority, | ||
:versioning_override, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:priority, | |
:versioning_override, | |
:versioning_override, | |
:priority, |
Pedantic, but might as well keep in the same order as the parameters of the outer call
@@ -70,6 +70,7 @@ def start_workflow(input) | |||
input.static_summary, input.static_details, @client.data_converter | |||
), | |||
header: ProtoUtils.headers_to_proto(input.headers, @client.data_converter), | |||
priority: input.priority&._to_proto, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priority: input.priority&._to_proto, | |
priority: input.priority._to_proto, |
Same for everywhere else where priority actually can't be nil
# The overall semantics of Priority are: | ||
# 1. First, consider "priority_key": lower number goes first. | ||
# (more will be added here later). | ||
class Priority |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this should be a Data
class (and get all of the goodies it provides). I think it makes sense like record
did for .NET and @dataclass
did for Python. Still will need much of what you have here (so after the Data.define
, re-open the class Priority
to add stuff).
@@ -148,12 +149,14 @@ def self.execute_activity( | |||
cancellation: Workflow.cancellation, | |||
cancellation_type: ActivityCancellationType::TRY_CANCEL, | |||
activity_id: nil, | |||
disable_eager_execution: false | |||
disable_eager_execution: false, | |||
priority: Priority.default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the import to this file and to activity.rb
? I know it doesn't make sense to add everywhere, but along with temporalio/client
, these two are kinda "single require entry points" to the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking
require 'temporalio/api' | ||
|
||
module Temporalio | ||
Priority = Data.define( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to default a field for this you can still leave the initialize
the way you had it in the class and just call super, e.g.
def initialize(priority_key: nil)
super
end
But requiring it is fine too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, honestly requiring it makes more sense
class Priority | ||
attr_reader priority_key: Integer? | ||
|
||
def initialize: (?priority_key: Integer?) -> void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def initialize: (?priority_key: Integer?) -> void | |
def initialize: (priority_key: Integer?) -> void |
Pedantic though
@@ -10,6 +10,7 @@ module Temporalio | |||
attr_reader last_result: Object? | |||
attr_reader namespace: String | |||
attr_reader parent: ParentInfo? | |||
attr_reader priority: Temporalio::Priority? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attr_reader priority: Temporalio::Priority? | |
attr_reader priority: Temporalio::Priority |
@@ -8,6 +8,7 @@ module Temporalio | |||
attr_reader heartbeat_details: Array[Object?] | |||
attr_reader heartbeat_timeout: Float? | |||
attr_reader local?: bool | |||
attr_reader priority: Temporalio::Priority? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attr_reader priority: Temporalio::Priority? | |
attr_reader priority: Temporalio::Priority |
What was changed
Updated Core
Expose priority setting on workflow client & in child/activities launched from workflows
Why?
Priorities are cool!
Checklist
Closes [Feature Request] Support Priority Annotations #210
How was this tested:
Added integ test
Any docs updates needed?