Skip to content

Commit b6c4fe8

Browse files
committed
Avoid anonymous collection init
because it creates unexpected references that can get in the way of garbage collection
1 parent 71948e9 commit b6c4fe8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pipeline/src/main/java/org/neo4j/gds/ml/pipeline/linkPipeline/train/LinkPredictionTrainPipelineExecutor.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,16 @@ public LinkPredictionTrainPipelineExecutor(
9393

9494
public static Task progressTask(String taskName, LinkPredictionTrainingPipeline pipeline, long relationshipCount) {
9595
var sizes = pipeline.splitConfig().expectedSetSizes(relationshipCount);
96-
return Tasks.task(taskName, new ArrayList<>() {{
97-
add(LinkPredictionRelationshipSampler.progressTask(sizes));
98-
add(NodePropertyStepExecutor.tasks(pipeline.nodePropertySteps(), sizes.featureInputSize()));
99-
addAll(LinkPredictionTrain.progressTasks(
100-
relationshipCount,
101-
pipeline.splitConfig(),
102-
pipeline.numberOfModelSelectionTrials()
103-
));
104-
}});
96+
List<Task> childTasks = new ArrayList<>();
97+
childTasks.add(LinkPredictionRelationshipSampler.progressTask(sizes));
98+
childTasks.add(NodePropertyStepExecutor.tasks(pipeline.nodePropertySteps(), sizes.featureInputSize()));
99+
childTasks.addAll(LinkPredictionTrain.progressTasks(
100+
relationshipCount,
101+
pipeline.splitConfig(),
102+
pipeline.numberOfModelSelectionTrials()
103+
));
104+
105+
return Tasks.task(taskName, childTasks);
105106
}
106107

107108
public static MemoryEstimation estimate(

0 commit comments

Comments
 (0)