-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net Processes: State Management in Processes Part 1 (#9424)
### Description This is the first one of a few PR that address the State Management in SK Processes. Dividing in smaller PRs since feature contain multiple big components. #### In this PR - **SAVE:** After running a Process, adding capability to extract process state for stateful processes - works also with nested processes - **LOAD:** from a Process State data structure, loading state to ProcessBuilder before `Build()` to apply it to Process and use it on runtime. For now only focusing on Step State only, not focusing on exact replica of processes (using same ids) - **Samples:** Adding more samples in Step02_FoodPrep that load existing State from file and use it to run specific food pre processes, also samples on how to save the state #### Out of Scope but coming up in future PRs - How to deal with processes running that have the same id (processid, stepid) - In the future, ProcessStep State will have versions, so if loading an old state to a process with a new state version there is: - validation - migration strategy placeholder to add custom state migration - A new way to create ProcessBuilders so that on save, processTypeIds can be interpreted instead of needing to pass all steps, and edges when loading a ProcessBuilder from file - current DAPR implementation - More samples showcasing more complex scenarios ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
- Loading branch information
1 parent
ea5ceb1
commit d2696a9
Showing
23 changed files
with
587 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...s/GettingStartedWithProcesses/Step03/ProcessesStates/FishSandwichStateProcessSuccess.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"stepsState": { | ||
"FriedFishWithStatefulStepsProcess": { | ||
"stepsState": { | ||
"GatherFriedFishIngredientsWithStockStep": { | ||
"state": { | ||
"IngredientsStock": 3 | ||
}, | ||
"id": "cfc7d51f3bfa455c980d282dcdd85b13", | ||
"name": "GatherFriedFishIngredientsWithStockStep" | ||
}, | ||
"chopStep": { | ||
"state": { | ||
"KnifeSharpness": 2 | ||
}, | ||
"id": "daf4a782df094deeb111ae701431ddbb", | ||
"name": "chopStep" | ||
}, | ||
"FryFoodStep": { | ||
"id": "e508ffe1d4714097b9716db1fd48b587", | ||
"name": "FryFoodStep" | ||
} | ||
}, | ||
"id": "a201334a1f534e9db9e1d46dce8345a8", | ||
"name": "FriedFishWithStatefulStepsProcess" | ||
}, | ||
"AddBunsStep": { | ||
"id": "8a9b2d66e0594ee898d1c94c8bc07d0e", | ||
"name": "AddBunsStep" | ||
}, | ||
"AddSpecialSauceStep": { | ||
"id": "6b0e92097cb74f5cbac2a71473a4e9c2", | ||
"name": "AddSpecialSauceStep" | ||
}, | ||
"ExternalFriedFishStep": { | ||
"id": "59ebd4724684469ab19d86d281c205e3", | ||
"name": "ExternalFriedFishStep" | ||
} | ||
}, | ||
"id": "38e8f477-c022-41fc-89f1-3dd3509d0e83", | ||
"name": "FishSandwichWithStatefulStepsProcess" | ||
} |
42 changes: 42 additions & 0 deletions
42
...gStartedWithProcesses/Step03/ProcessesStates/FishSandwichStateProcessSuccessLowStock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"stepsState": { | ||
"FriedFishWithStatefulStepsProcess": { | ||
"stepsState": { | ||
"GatherFriedFishIngredientsWithStockStep": { | ||
"state": { | ||
"IngredientsStock": 1 | ||
}, | ||
"id": "cfc7d51f3bfa455c980d282dcdd85b13", | ||
"name": "GatherFriedFishIngredientsWithStockStep" | ||
}, | ||
"chopStep": { | ||
"state": { | ||
"KnifeSharpness": 2 | ||
}, | ||
"id": "daf4a782df094deeb111ae701431ddbb", | ||
"name": "chopStep" | ||
}, | ||
"FryFoodStep": { | ||
"id": "e508ffe1d4714097b9716db1fd48b587", | ||
"name": "FryFoodStep" | ||
} | ||
}, | ||
"id": "a201334a1f534e9db9e1d46dce8345a8", | ||
"name": "FriedFishWithStatefulStepsProcess" | ||
}, | ||
"AddBunsStep": { | ||
"id": "8a9b2d66e0594ee898d1c94c8bc07d0e", | ||
"name": "AddBunsStep" | ||
}, | ||
"AddSpecialSauceStep": { | ||
"id": "6b0e92097cb74f5cbac2a71473a4e9c2", | ||
"name": "AddSpecialSauceStep" | ||
}, | ||
"ExternalFriedFishStep": { | ||
"id": "59ebd4724684469ab19d86d281c205e3", | ||
"name": "ExternalFriedFishStep" | ||
} | ||
}, | ||
"id": "38e8f477-c022-41fc-89f1-3dd3509d0e83", | ||
"name": "FishSandwichWithStatefulStepsProcess" | ||
} |
24 changes: 24 additions & 0 deletions
24
...ples/GettingStartedWithProcesses/Step03/ProcessesStates/FriedFishProcessStateSuccess.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"stepsState": { | ||
"GatherFriedFishIngredientsWithStockStep": { | ||
"state": { | ||
"IngredientsStock": 4 | ||
}, | ||
"id": "51b39c78e71148c9af0a3c44c83bc6f5", | ||
"name": "GatherFriedFishIngredientsWithStockStep" | ||
}, | ||
"chopStep": { | ||
"state": { | ||
"KnifeSharpness": 4 | ||
}, | ||
"id": "6be5207cb71e42c28d7061e45e1127c1", | ||
"name": "chopStep" | ||
}, | ||
"FryFoodStep": { | ||
"id": "9523d47a97a546908985a6ff028783cd", | ||
"name": "FryFoodStep" | ||
} | ||
}, | ||
"id": "1c90a002-68ca-4c68-ac3b-a083054ed628", | ||
"name": "FriedFishWithStatefulStepsProcess" | ||
} |
24 changes: 24 additions & 0 deletions
24
...tingStartedWithProcesses/Step03/ProcessesStates/FriedFishProcessStateSuccessLowStock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"stepsState": { | ||
"GatherFriedFishIngredientsWithStockStep": { | ||
"state": { | ||
"IngredientsStock": 1 | ||
}, | ||
"id": "51b39c78e71148c9af0a3c44c83bc6f5", | ||
"name": "GatherFriedFishIngredientsWithStockStep" | ||
}, | ||
"chopStep": { | ||
"state": { | ||
"KnifeSharpness": 4 | ||
}, | ||
"id": "6be5207cb71e42c28d7061e45e1127c1", | ||
"name": "chopStep" | ||
}, | ||
"FryFoodStep": { | ||
"id": "9523d47a97a546908985a6ff028783cd", | ||
"name": "FryFoodStep" | ||
} | ||
}, | ||
"id": "1c90a002-68ca-4c68-ac3b-a083054ed628", | ||
"name": "FriedFishWithStatefulStepsProcess" | ||
} |
24 changes: 24 additions & 0 deletions
24
...ttingStartedWithProcesses/Step03/ProcessesStates/FriedFishProcessStateSuccessNoStock.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"stepsState": { | ||
"GatherFriedFishIngredientsWithStockStep": { | ||
"state": { | ||
"IngredientsStock": 0 | ||
}, | ||
"id": "51b39c78e71148c9af0a3c44c83bc6f5", | ||
"name": "GatherFriedFishIngredientsWithStockStep" | ||
}, | ||
"chopStep": { | ||
"state": { | ||
"KnifeSharpness": 4 | ||
}, | ||
"id": "6be5207cb71e42c28d7061e45e1127c1", | ||
"name": "chopStep" | ||
}, | ||
"FryFoodStep": { | ||
"id": "9523d47a97a546908985a6ff028783cd", | ||
"name": "FryFoodStep" | ||
} | ||
}, | ||
"id": "1c90a002-68ca-4c68-ac3b-a083054ed628", | ||
"name": "FriedFishWithStatefulStepsProcess" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.