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

.Net Processes - Map Step Feature #9339

Open
wants to merge 100 commits into
base: main
Choose a base branch
from
Open

.Net Processes - Map Step Feature #9339

wants to merge 100 commits into from

Conversation

crickman
Copy link
Contributor

@crickman crickman commented Oct 20, 2024

Motivation and Context

Fixes: #9193

Description

Map each value from a set to a map-operation and present the results as a set for potential reduction.

Includes:

  • ProcessMapBuilder (Core)
  • KernelProcessMap / KernelProcessMapState (Abstractions)
  • LocalMap (LocalRuntime)
  • MapActor (DaprRuntime)
  • Serialization
  • Unit Tests (exhaustive)
  • Integration Tests
  • Sample

Features:

  • Executes map operations in parallel
  • Handles when output type has been transformed from input type
  • Accepts either step or subprocess for map operation
  • Proxies events for edges defined directly on the map-step
  • Allows additional (non proxied) edges for the map-operation
  • Participates in state serialization

Follow-up:

Contribution Checklist

@crickman crickman added PR: in progress Under development and/or addressing feedback .NET Issue or Pull requests regarding .NET code experimental Associated with an experimental feature enhancement processes labels Oct 20, 2024
@crickman crickman self-assigned this Oct 20, 2024
@github-actions github-actions bot changed the title .NET Processes - Map Step Feature .Net Processes - Map Step Feature Oct 20, 2024
ProcessBuilder process = new(nameof(TestMapAsync));

ProcessStepBuilder computeStep = process.AddStepFromType<ComputeStep>();
ProcessMapBuilder mapStep = process.AddMapForTarget(new ProcessFunctionTargetBuilder(computeStep));
Copy link
Contributor

@esttenorio esttenorio Nov 8, 2024

Choose a reason for hiding this comment

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

[brainstorming hypothetical scenario]
wondering if these 2[line 40-41] should be a single function? since compute is not actually used by the root process directly having it instantiated on the level computeStep could in theory also be used as a regular step:

graph TD
root["root process"]-->map-->compute1["compute"]
root-->compute2["compute"]
Loading

Copy link
Contributor Author

@crickman crickman Nov 8, 2024

Choose a reason for hiding this comment

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

Good question. Ben and I were discussing this also. There is a case where an edge may be defined outside of the map-operation: https://github.com/microsoft/semantic-kernel/blob/processes-map-step/dotnet/src/Experimental/Process.UnitTests/Runtime.Local/LocalMapTests.cs#L295

graph TD
root["root process"]--N-->map
subgraph map
compute1["compute"]
end
compute1["compute"]--1-->orthogonal
compute1["compute"]--N-->union
root--extra/noharm-->compute2["compute"]
Loading

The other factor to consider is when the map operation is a subprocess...such a pattern would also result in being explicitly handled by the caller (first create sub-process, then associate with map). The difference for step is that the builders only allow creating one from the process builder...which in turn always adds it to the step collection of the process.

I'm am certainly open to exploring any potential improvements, but it also feels like we need to be careful to consider the breadth of patterns that make sense and avoid disrupting others that are useful.

FYI - I'll planning on spending some time exploring alternative patterns here...just want to be careful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement experimental Associated with an experimental feature .NET Issue or Pull requests regarding .NET code PR: ready for review All feedback addressed, ready for reviews processes
Projects
Status: Sprint: In Review
Development

Successfully merging this pull request may close these issues.

.Net: Process Framework: Map Step
2 participants