Skip to content

Conversation

@halspang
Copy link
Member

This commit adds an explict set for Version in TaskName. It also includes a flag that is set so other code can determine if the TaskName is intended to be versioned. Finally, it updates the Version property in the TaskOrchestrationContext as that was always set to empty instead of being able to be used.

@jviau
Copy link
Member

jviau commented Apr 28, 2025

@halspang have you taken a look at the previous PR that attempts to do this? #295. There are discussions there around breaking changes, round tripping of to and from string.

@halspang
Copy link
Member Author

halspang commented May 8, 2025

@jviau - I wasn't aware of that context, thanks for linking it. I'll go through it and see if I can determine a path forward there. In the meantime, I separated out the context change as I think this change should be isolated and that's the more important change that I need for versioning functionality in the extension.

#424

halspang added 2 commits May 15, 2025 17:44
This commit adds an explict set for Version in TaskName. It also
includes a flag that is set so other code can determine if the
TaskName is intended to be versioned. Finally, it updates the
Version property in the TaskOrchestrationContext as that was always
set to empty instead of being able to be used.

Signed-off-by: halspang <[email protected]>
@halspang halspang force-pushed the halspang/taskname_version branch from 766fa69 to bb993ca Compare May 16, 2025 00:45
@halspang
Copy link
Member Author

@jviau @cgillum

This PR changed up a bit, but it has the updates from discussion had offline. The tl;dr of those conversations was to introduce a TaskVersion and utilize it in the Options of starting an orchestration. This means we don't worry about the round-trip of the TaskName.Version and don't have to make decisions about what divides the name/version. Overall, it's much safer and I feel a better pattern to follow going forward. I kept it in this PR to keep the history, though I can close and open a new one if we feel it should be redone.

Copy link
Member

@jviau jviau left a comment

Choose a reason for hiding this comment

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

Please address all the warnings from adding [Obsolete] to the version property.

Copy link
Member Author

@halspang halspang left a comment

Choose a reason for hiding this comment

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

Updated the warnings for Obsolete/changed the reference where appropriate.

=> options is SubOrchestrationOptions derived ? derived.InstanceId : null;
string instanceId = GetInstanceId(options) ?? this.NewGuid().ToString("N");
string defaultVersion = this.invocationContext.Options?.Versioning?.DefaultVersion ?? string.Empty;
string version = options is SubOrchestrationOptions subOptions ? subOptions.Version : defaultVersion;
Copy link
Member

Choose a reason for hiding this comment

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

I just want to leave a comment regarding what we discussed offline here. I don't think it is a good idea to conflate worker version and orchestration version. I see these as separate concerns.

Worker version is purely for routing and supporting rolling updates.
Orchestration version is for enabling an API-versioning-esque scheme for backcompat.

Having worker version apply as a default to orchestration version unnecessarily complicates that scenario. Now customers need to think about how their individual orchestrations version in relation to their worker version as a whole. Which one takes precedence? How does a worker version less than an orchestration version behave? What if they aren't comparable at all?

All of these questions will need to be considered, answered, and documented if we keep these intertangled. Whereas if we just keep them entirely separate then answering all of that becomes much simpler.

Copy link
Member Author

Choose a reason for hiding this comment

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

I appreciate the comment and the conversation we had offline about this! I'll make sure that this is all clearly documented/explained.

Having worker version apply as a default to orchestration version unnecessarily complicates that scenario. Now customers need to think about how their individual orchestrations version in relation to their worker version as a whole. Which one takes precedence? How does a worker version less than an orchestration version behave? What if they aren't comparable at all?

The default version only really applies to sub-orchestrations from a Worker point of view. It's matching the client side's default version. In my opinion, the worker shouldn't be starting sub-orchestrations without the client but since it does, we provide a means of setting it. For functions apps, this is the same host.json value. For apps just using this SDK, it does look a little weird as you have to supply it in both the client and the worker options.

In regard to what takes precedence, it's always the version set by the options when scheduling an orchestration. The worker version is only used for the matching/accepting of an orchestration. The way they interact is set with the version matching strategy and the version failure strategy. The docs aren't published to learn yet as we wanted support across the SDKs and DTFx first, but this sample readme talks about the interaction: Orchestration versioning sample.

Copy link
Member

@cgillum cgillum May 21, 2025

Choose a reason for hiding this comment

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

Not sure if this was covered in the offline discussion, but it's probably best to not think of or describe this as a "worker version", but rather as a "default orchestration version" which happens to be something that can be configured at a client and/or worker level.

/// <summary>
/// Gets the version to associate with the sub-orchestration instance.
/// </summary>
public TaskVersion Version { get; init; } = default!;
Copy link
Member

Choose a reason for hiding this comment

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

Have we evaluated versioning for TaskActivity? DurableTask.Core has it. I personally haven't used it much myself, unlike orchestration versioning which I used extensively. Still wondering if it is planned?

Copy link
Member Author

Choose a reason for hiding this comment

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

I also haven't used it much, the initial thought here is that differently versioned orchestrations can have the different activities and different version activities in the same orchestration were less likely.

That being said, we've left the door open for it, so if it's a requested feature or something we agree to as a team we can still implement it down the road.

@halspang halspang merged commit 44969e1 into microsoft:main May 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants