Skip to content

TaskGroups for chasm tasks#9949

Open
S15 wants to merge 8 commits intotemporalio:mainfrom
S15:taskgroups-for-chasm
Open

TaskGroups for chasm tasks#9949
S15 wants to merge 8 commits intotemporalio:mainfrom
S15:taskgroups-for-chasm

Conversation

@S15
Copy link
Copy Markdown
Contributor

@S15 S15 commented Apr 14, 2026

What changed?

Adds a TaskGroup identifier for chasm side-effect handlers, threaded through registered tasks.

Why?

Enables chasm tasks to lookup their TaskGroup after being deserialized, so like-tasks can be grouped together.

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

@S15 S15 changed the title Taskgroups for chasm TaskGroups for chasm tasks Apr 14, 2026
@S15 S15 marked this pull request as ready for review April 14, 2026 21:59
@S15 S15 requested review from a team as code owners April 14, 2026 21:59
@bergundy bergundy self-requested a review April 14, 2026 22:00
Comment thread chasm/task.go Outdated
Discard(context.Context, ComponentRef, TaskAttributes, T) error

// TaskGroup returns an identifier used to group side-effect tasks together for outbound circuit breaking
TaskGroup() string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm I think it's a property of the Task itself not the TaskHandler.

I think we have RegistrableTaskOption type defined for this purpose, can we use that instead and it will be the first use case. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think putting it on the task handler is more flexible since you can act on a concrete task instance and dynamically set the group. But I don't have a concrete use case in mind so I'm okay with what @yycptt is suggesting.

Comment thread common/persistence/execution_manager.go Outdated

if ct, ok := task.(*tasks.ChasmTask); ok && m.chasmRegistry != nil {
if rt, ok := m.chasmRegistry.TaskByID(ct.Info.GetTypeId()); ok {
ct.TaskGroup = rt.TaskGroup()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we move this logic into GrouperStateMachineNamespaceIDAndDestination implementation? Then only outbound queue will be doing this look up, and we don't need to change general persistence layer logic.

Copy link
Copy Markdown
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. Thanks!

Comment thread chasm/lib/nexusoperation/operation.go Outdated
NexusLink nexus.Link
}

const TaskGroupName = "nexusoperations"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might as well use the name of the package

Suggested change
const TaskGroupName = "nexusoperations"
const TaskGroupName = "nexusoperation"

But since this is going into persistence, I would consider shortening it to just nexus.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's not persisted based on my reading of the PR.

Comment thread chasm/registrable_task.go Outdated
func(ctx context.Context, ref ComponentRef, attrs TaskAttributes, task any) error {
return handler.Discard(ctx, ref, attrs, task.(T))
},
handler.TaskGroup(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you're not going to call this at runtime (contrary to what we discussed), I would 100% make it a registration option. Let's just go with registration option as @yycptt suggests.

@S15 S15 force-pushed the taskgroups-for-chasm branch from aab4396 to af6e0a2 Compare April 15, 2026 21:47
logger,
metricsHandler,
factory,
chasmTaskGroupPostProcessor(f.ChasmRegistry),
Copy link
Copy Markdown
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 able to convince myself doing this in GrouperStateMachineNamespaceIDAndDestination would cover e.g. OutboundTaskPredicate.Test where StateMachineTaskGroup is called directly, after tasks are loaded. So this seemed like the earliest after loading, before the tasks are really used, and also outside general persistence.

if y'all happen to know that the predicate testing isn't a concern, then I can move this again.

@S15 S15 requested review from bergundy and yycptt April 15, 2026 21:57
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