Comments (2)
Hey there, great question!
For clarification, you have an ActionType node where the ChildSelectors do not find a match and return. When you retry by calling WalkTree on the same CurrentTreeNode some minutes later, you want the Actions to execute again. If that's not what you are asking, please let me know.
You have a few options. Let me give you some context/information first. Forge supports cycles (i.e. revisiting TreeNodes). You can find the logic and comments here: https://github.com/microsoft/Forge/blob/master/Forge.TreeWalker/src/TreeWalkerSession.cs#L1117
// If we are revisiting a node that has been previously completed and we aren't rehydrating,
// clear the ActionResponses and Intermediates, and persist PreviousActionResponses.
Forge is considered "Rehydrating" in this context until it has successfully committed the CurrentTreeNode. So in the case where you create a new TreeWalkerSession and retry WalkTree at your desired TreeNode, the hasSessionRehydrated flag is false, and therefore the cycle logic does not get executed. This is the expected behavior, to NOT retry by default. If we are rehydrating and the ActionResponses already exist on the TreeNode, that means the Actions have already finished executing so we skip to the ChildSelection. We intentionally do not re-execute the Actions.
With that context, here are some options:
- Satisfy the hasSessionRehydrated flag by visiting a TreeNode that points to your desired retry_TreeNode.
You don't have to retry WalkTree on the CurrentTreeNode you left off on. You can call WalkTree from any TreeNode, anytime. If your retry_TreeNode had a simple parent TreeNode with a single ChildSelector, you could WalkTree on this parent TreeNode. This would allow hasSessionRehydrated to become true, and your retry_TreeNode would get it's ActionResponses wiped and Actions re-executed. - Instead of not matching a ChildSelector, go to a child with an Action that runs Task.Delay for the desired amount of minutes with a ChildSelector pointing back to your desired retry_TreeNode.
This takes advantage of Forge's built-in cycle logic by revisiting the TreeNode in the same WalkTree session. - Manually remove the ActionResponses that you wish to retry from the IForgeDictionary between retries.
When you then call WalkTree on your desired retry_TreeNode, the ActionResponses will not exist so the Actions will get re-executed.
Overall I would lean towards option 2, since the other options are a bit hacky. But anything should work.
Also, if you agree, we could create a feature request to add a "RetryCurrentTreeNodeActions" property to TreeWalkerParameters. This would basically override the hasSessionRehydrated check and always re-execute Actions whenever a TreeNode is visited. Let me know if this would be useful to you, and we can look at putting it in the next release.
Thanks!
--Travis
from forge.
Thank you kijujjav for sending a pull request to add a new RetryCurrentTreeNodeActions flag. The latest released version (1.0.59) contains the flag. Closing this issue on this PR: #46
from forge.
Related Issues (20)
- Can Forge re-walk previous nodes? HOT 1
- Feature Ask - Allow application to choose when to invoke the forge action retry policy
- Feature Ask - Allow application to run custom code when Forge sees exceptions
- Add option to construct a TreeWalkerParameters with a ForgeTree instead of JsonSchema
- Make RetryExhaustedOnAction and TimeoutOnAction strings accessible from Tree
- SubroutineInput - StartOverOnRetry flag
- Add callback after LeafNode ActionResponse gets persisted
- CachedVariable for ChildSelectors HOT 1
- FinallyTrees - Ability to execute code before ending the tree walker session
- Casting ActionResponse Output object to custom types in Forge schema HOT 2
- Migrate to NetStandard 2.0 HOT 2
- Does Forge expose any API to validate schemas HOT 4
- EvaluateDynamicProperty inconsistent behavior for version 1.0.55 [Bug] HOT 2
- Can we throw custom exception from child in schema? HOT 2
- What is the current status of Forge and ForgeEditor? HOT 2
- How to download/use ForgeEditor? HOT 4
- This repo is missing important files
- ForgeSchemaValidator Fails in Validating Schemas with Parallel Action or Subroutine elements HOT 2
- Action Responses not persisted in ForgeState when two parallel actions complete their execution at the same time intermittently
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forge.