Skip to content
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

Attach current Build ID to workflow activations #619

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

Sushisource
Copy link
Member

What was changed

Add current build id as a field on workflow activations

Why?

So users can tell during replay what build id was used to process the current task.

Checklist

  1. Closes [Feature Request] Expose build ID via WorkflowInfo. features#253

  2. How was this tested:
    Added unit test

  3. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner October 25, 2023 22:23
Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Overall LGTM, I just have a nit about the structuring of the code.

@@ -147,6 +149,11 @@ impl WorkflowActivationExt for WorkflowActivation {
variant: Some(workflow_activation_job::Variant::QueryWorkflow(qr))
}] if qr.query_id == LEGACY_QUERY_ID)
}
fn attach_build_id_if_needed(&mut self, build_id: &str) {
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit confusing, why would this logic be on a proto struct, it doesn't know when attaching is needed.
I would put it in the worker logic before it hands over the activation or better yet when the activation is created to avoid mutating unnecessarily.

Copy link
Member Author

Choose a reason for hiding this comment

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

It can't really be when the activation is created without passing the build id down a few layers where it's not currently needed (and would get cloned a bunch of times). I can just inline the method where it's used though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Inlined it w/ comment

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

LGTM.

Lang impl note: In Python and .NET we have tried to make properties on the info immutable for the life of the run (even if the contents of that property's object may change). So we'll either be exposing this as a method on the info (Python only if so), or top-level on the workflow context. Other languages however may not have this immutability rule.

@Sushisource Sushisource enabled auto-merge (squash) October 26, 2023 16:42
@Sushisource Sushisource force-pushed the expose-build-id-wfinfo branch from ce07a2d to 9c5796e Compare October 26, 2023 16:49
@Sushisource Sushisource merged commit 3200785 into temporalio:master Oct 26, 2023
3 checks passed
@Sushisource Sushisource deleted the expose-build-id-wfinfo branch October 27, 2023 16:27
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.

[Feature Request] Expose build ID via WorkflowInfo.
3 participants