-
Notifications
You must be signed in to change notification settings - Fork 123
Worker Deployment Versioning #1679
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
Conversation
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.
Didn't really look through the core bridge stuff, maybe worth coordinating on #1638.
For your workflow test files deployment-versioning-no-annotations...
there's a workflows
directory in test/src
that might make more sense for them to be located, instead of directly in test/src
.
Just want to re-affirm how this works:
- on the worker, we have the worker's configured deployment version, and the default versioning behaviour for all its workflows
- on the workflow, we can override this versioning behaviour with the newly added workflow definition options (it's a little funky, we're making use of JS's quirk that a function is an object, so a workflow with definition options is a function with properties, as already discussed)
- workflow versioning behaviour is read into the activator (which uses it solely when concluding the activation) and workflow info
Tests were helpful, though I think you probably want someone whose more familiar with the versioning behaviour to take a look
a120422
to
e59e2d0
Compare
a8d4a69
to
f18b1ca
Compare
This will need to hang out for a bit since I want temporalio/api#579 in before I incorporate that |
218743e
to
8169797
Compare
e79e306
to
3ee553e
Compare
/** | ||
* A workflow function that has been defined with options from {@link WorkflowDefinitionOptions}. | ||
*/ | ||
export interface WorkflowFunctionWithOptions<Args extends any[], ReturnType> extends AsyncFunction<Args, ReturnType> { |
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.
Does this have any value being exported publicly? If yes, then AsyncFunction
should also be exported. If not, then please add @internal
and @hidden
(I will have to experiment a bit more to figure out how to reduce this to a single annotation, but in the mean time, let's use both).
0382bdf
to
48bbb74
Compare
4c67a37
to
ee0f8ed
Compare
ee0f8ed
to
129ab88
Compare
9209367
to
f60c0a0
Compare
@@ -1227,6 +1227,7 @@ export class WorkflowClient extends BaseClient { | |||
cronSchedule: options.cronSchedule, | |||
header: { fields: headers }, | |||
priority: options.priority ? compilePriority(options.priority) : undefined, | |||
versioningOverride: options.versioningOverride ? options.versioningOverride : undefined, |
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.
versioningOverride: options.versioningOverride ? options.versioningOverride : undefined, | |
versioningOverride: options.versioningOverride ?? undefined, |
@@ -1296,6 +1297,7 @@ export class WorkflowClient extends BaseClient { | |||
cronSchedule: opts.cronSchedule, | |||
header: { fields: headers }, | |||
priority: opts.priority ? compilePriority(opts.priority) : undefined, | |||
versioningOverride: opts.versioningOverride ? opts.versioningOverride : undefined, |
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.
versioningOverride: opts.versioningOverride ? opts.versioningOverride : undefined, | |
versioningOverride: opts.versioningOverride ?? undefined, |
@@ -80,9 +80,27 @@ export function initRuntime(options: WorkflowCreateOptionsInternal): void { | |||
const defaultWorkflowFn = mod['default']; | |||
|
|||
if (typeof workflowFn === 'function') { | |||
activator.workflow = workflowFn; | |||
if (isWorkflowFunctionWithOptions(workflowFn)) { |
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.
Seems like those two branches are identical, and in both branches, you ned up making the assignment to activator.workflow
anyway. I'd suggest reverting to the original if-elseif-else
structure, and move the "workflow definition options" stuff after that whole block.
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.
Still a few nits, but no need for another round of review after that. You can safely ignore the unrelated test failures on the feature repo due to protobufjs, as well as the doc publish error due to vercel token needing refresh.
fd9e99c
to
bc6157f
Compare
What was changed
Added the annotations and options for worker-deployment-based versioning
Why?
All aboard the versioning train
Checklist
Closes [Feature Request] Support New Worker Versioning API #1659
How was this tested:
Added tests
Any docs updates needed?