Skip to content

Commit b865b80

Browse files
committed
Prevent removal of notReusable steps from new graph in GraphFusionTool
Signed-off-by: Ansari, Mujammil <mujammil.ansari@here.com>
1 parent 4675378 commit b865b80

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/execution/GraphFusionTool.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ protected static StepGraph fuseGraphs(Job newJob, StepGraph oldGraph) {
5353
}
5454

5555
protected static StepGraph fuseGraphs(String newJobId, StepGraph newGraph, StepGraph oldGraph) {
56-
newGraph = canonicalize(newGraph);
57-
oldGraph = canonicalize(oldGraph);
56+
newGraph = canonicalize(newGraph, false);
57+
oldGraph = canonicalize(oldGraph, true);
5858
CompilationStepGraph fusedGraph = replaceByDelegations(newGraph, oldGraph);
5959

6060
//Replace previous step relations (previousStepIds)
@@ -66,13 +66,17 @@ protected static StepGraph fuseGraphs(String newJobId, StepGraph newGraph, StepG
6666
}
6767

6868
protected static StepGraph canonicalize(StepGraph graph) {
69+
return canonicalize(graph, true);
70+
}
71+
72+
protected static StepGraph canonicalize(StepGraph graph, boolean removeNotReusableSteps) {
6973
/*
7074
1.) Remove all steps that are flagged as being "notReusable" (these should be basically hidden from the reusability process)
7175
2.) Then, remove empty sub-graphs (NOTE: The traversal is done in "bottom-up" manner so sub-graphs
7276
that became empty due to the removal of "notReusable" steps will be removed as well
7377
*/
7478
traverse(graph, execution -> {
75-
if (execution instanceof Step step && step.isNotReusable())
79+
if (execution instanceof Step step && step.isNotReusable() && removeNotReusableSteps)
7680
return null;
7781
if (execution instanceof StepGraph subGraph) {
7882
if (subGraph.isEmpty())

0 commit comments

Comments
 (0)