Skip to content

Commit

Permalink
Simplify a bit
Browse files Browse the repository at this point in the history
Signed-off-by: Hongxin Liang <[email protected]>
  • Loading branch information
honnix committed Oct 9, 2023
1 parent 1f50534 commit 7527748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ static ProjectClosure load(
rewrittenWorkflowTemplates,
workflowTemplate -> {
Map<WorkflowIdentifier, WorkflowTemplate> subWorkflows =
collectSubWorkflows(
workflowTemplate.nodes(), rewrittenWorkflowTemplates, Function.identity());
collectSubWorkflows(workflowTemplate.nodes(), rewrittenWorkflowTemplates);

return WorkflowSpec.builder()
.workflowTemplate(workflowTemplate)
Expand Down Expand Up @@ -344,6 +343,11 @@ && checkCycles(subWorkflowId, allWorkflows, beingVisited, visited))) {
}

@VisibleForTesting
static Map<WorkflowIdentifier, WorkflowTemplate> collectSubWorkflows(
List<Node> nodes, Map<WorkflowIdentifier, WorkflowTemplate> allWorkflows) {
return collectSubWorkflows(nodes, allWorkflows, Function.identity());
}

public static Map<WorkflowIdentifier, WorkflowTemplate> collectSubWorkflows(
List<Node> nodes,
Map<WorkflowIdentifier, WorkflowTemplate> allWorkflows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import org.flyte.api.v1.BooleanExpression;
import org.flyte.api.v1.BranchNode;
import org.flyte.api.v1.ComparisonExpression;
Expand Down Expand Up @@ -259,7 +258,7 @@ public void testCollectSubWorkflows() {
nestedOtherSubWorkflowRef, emptyWorkflowTemplate);

Map<WorkflowIdentifier, WorkflowTemplate> collectedSubWorkflows =
ProjectClosure.collectSubWorkflows(nodes, allWorkflows, Function.identity());
ProjectClosure.collectSubWorkflows(nodes, allWorkflows);

assertThat(
collectedSubWorkflows,
Expand Down

0 comments on commit 7527748

Please sign in to comment.