Skip to content

Add high level workflow describe #1924

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Add high level workflow describe

close #1667

@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner April 21, 2025 20:36
client/client.go Outdated
// - serviceerror.Internal
// - serviceerror.Unavailable
// - serviceerror.NotFound
DescribeWorkflow(ctx context.Context, workflowID, runID string) (*DescribeWorkflowExecution, error)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returned a pointer here for consistency with some other APIs

@@ -901,6 +917,27 @@ type QueryWorkflowWithOptionsResponse struct {
QueryRejected *querypb.QueryRejected
}

type WorkflowExecutionMetadata struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Works for me, though not the biggest fan of the term "metadata", but I know it's what Java uses, so up to you. I figure one day we'll deprecate all the bad forms of "list" and have a new "list" call that returns iter.Seq[WorkflowExecutionMetadata], but not sure if that affects your name choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you have a different name I am open to suggestions, when we add list I was going to add another type that would also embedded WorkflowExecutionMetadata

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, since WorkflowExecution is already in use elsewhere, this is fine. Not sure at list time we need another type since list contents should be a subset of describe, but can discuss at that time.

client/client.go Outdated
// - serviceerror.Internal
// - serviceerror.Unavailable
// - serviceerror.NotFound
DescribeWorkflow(ctx context.Context, workflowID, runID string) (*DescribeWorkflowExecution, error)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to accept DescribeWorkflowOptions for future proofing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking we would add DescribeWorkflowWithOptions if we ever add more options here

@@ -1133,6 +1136,16 @@ type (
// - serviceerror.NotFound
DescribeWorkflowExecution(ctx context.Context, workflowID, runID string) (*workflowservice.DescribeWorkflowExecutionResponse, error)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to discourage/deprecate this in favor of either using DescribeWorkflow or WorkflowService().DescribeWorkflowExecution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't going to as part of this PR, I think if we want to deprecate these calls that just directly call the WorkflowService() we should deprecate them all.

Copy link
Member

Choose a reason for hiding this comment

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

👍 Would support deprecating any high-level ones that don't really provide value over direct gRPC call, but definitely for this one we should deprecate the other one (can be separate PR)

@@ -901,6 +917,27 @@ type QueryWorkflowWithOptionsResponse struct {
QueryRejected *querypb.QueryRejected
}

type WorkflowExecutionMetadata struct {
Copy link
Member

Choose a reason for hiding this comment

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

Works for me, though not the biggest fan of the term "metadata", but I know it's what Java uses, so up to you. I figure one day we'll deprecate all the bad forms of "list" and have a new "list" call that returns iter.Seq[WorkflowExecutionMetadata], but not sure if that affects your name choice.

// GetStaticSummary returns the summary set on workflow start.
//
// NOTE: Experimental
func (w *WorkflowExecutionDescription) GetStaticSummary() (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Arguably could be worth memoizing e.g. behind a sync.Once, but no strong opinion

client/client.go Outdated
@@ -269,6 +269,9 @@ type (
// QueryWorkflowWithOptionsResponse defines the response to QueryWorkflowWithOptions.
QueryWorkflowWithOptionsResponse = internal.QueryWorkflowWithOptionsResponse

// DescribeWorkflowExecution defines the response to DescribeWorkflow.
DescribeWorkflowExecution = internal.WorkflowExecutionDescription
Copy link
Member

Choose a reason for hiding this comment

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

Though you don't technically have to, I think you should also export the embedded field type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the use case for the exported embedded field type?

Copy link
Member

@cretz cretz Apr 23, 2025

Choose a reason for hiding this comment

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

For tests, people often appreciate the ability to easily instantiate the objects our clients can return. In this case, you have to instantiate and then set one field at a time as separate statements because you can't instantiate this embedded field explicitly. I think it's a reasonable rule that "every struct that is exported should also have its exported fields' types exported" (unless there's a good reason to have a non-exported interface, which is possible but rare)

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.

Add high-level workflow describe
3 participants