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

[ROBO-3381] split and merge poc #306

Draft
wants to merge 61 commits into
base: develop
Choose a base branch
from
Draft

Conversation

mihainradu
Copy link
Collaborator

No description provided.

@mihainradu mihainradu changed the title split and merge poc ROBO-3381 split and merge poc Mar 7, 2024
@mihainradu mihainradu changed the title ROBO-3381 split and merge poc [ROBO-3381] split and merge poc Mar 7, 2024
@mihainradu mihainradu force-pushed the feature/mr-bpm-playground branch 5 times, most recently from a09d674 to bb5a103 Compare March 11, 2024 08:03
@mihainradu mihainradu force-pushed the feature/mr-bpm-playground branch 7 times, most recently from edee40b to 353521f Compare April 4, 2024 13:14
@mihainradu mihainradu force-pushed the feature/mr-bpm-playground branch 5 times, most recently from 5a81556 to 9b8139c Compare April 11, 2024 14:09
@mihainradu mihainradu changed the base branch from develop to feature/mr-bpm April 15, 2024 12:34
@mihainradu mihainradu changed the base branch from feature/mr-bpm to develop April 15, 2024 12:36
Comment on lines 162 to 167
HashSet<FlowMerge> allMerges = new();
foreach (var branch in split.Branches)
{
var merges = GetMerges(branch).Distinct().ToList();
allMerges.AddRange(merges);
}

Choose a reason for hiding this comment

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

You can simplify by getting all the merges for a split, e.g.:
var allMerges = GetMerges(split)

and GetMerges can be:

List<FlowMerge> GetMerges(FlowSplit flowSplit) { return ( from nodeInfo in _staticBranchesByNode where nodeInfo.Key is FlowMerge where nodeInfo.Value.GetTop().Contains(flowSplit) select nodeInfo.Key as FlowMerge ).ToList(); }

SourceDetail = new[] { node }.Concat(otherNodes ?? Array.Empty<FlowNode>()).ToArray()
});
}
List<FlowMerge> GetMerges(FlowNode flowNode)

Choose a reason for hiding this comment

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

Change to return the merges for a split

AddStack(preStacks.SplitsStack);
}

private void AddStack(List<List<FlowSplit>> stack)

Choose a reason for hiding this comment

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

Name proposal: AddUniqueStack

}

private bool HasStack(List<FlowSplit> stack)
=> SplitsStack.Any(b => stack.Count == b.Count && stack.All(p => b.Contains(p)));

Choose a reason for hiding this comment

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

=> SplitsStack.Any(s => s.SequenceEqual(stack));

private bool HasStack(List<FlowSplit> stack)
=> SplitsStack.Any(b => stack.Count == b.Count && stack.All(p => b.Contains(p)));

internal bool IsOnStack(StaticNodeStackInfo toConfirm)

Choose a reason for hiding this comment

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

Not needed, if you rewrite the GetMerges method


public void AddPop(StaticNodeStackInfo popFrom)
{
var result = popFrom.SplitsStack.Select(s => Enumerable.Reverse(s).Skip(1).Reverse().ToList()).ToList();

Choose a reason for hiding this comment

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

Quite difficult to understand

return new (SplitsStack.Select(b => b.LastOrDefault()));
}

public void Push(FlowSplit newSplit, StaticNodeStackInfo splitsStackInfo)

Choose a reason for hiding this comment

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

Naming: Push vs AddPop

Fx.Assert(completedInstance != null, "cannot request cancel if we never scheduled any children");
// we are done but the last child didn't complete successfully
if (completedInstance.State != ActivityInstanceState.Closed)
if (WasVisited(current))

Choose a reason for hiding this comment

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

WasVisited is based on node.Flowchart != null.
I did not understand if the new nodes are created every time before CacheMetadata

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

?

@mihainradu mihainradu force-pushed the feature/mr-bpm-playground branch 6 times, most recently from 531bdcd to 8b65fa6 Compare April 16, 2024 10:25
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.

None yet

2 participants