Skip to content

Commit 659aad7

Browse files
authored
Merge pull request #5334 from adamnsch/jobid-in-configs
Add `jobId` field to algo and project configs
2 parents 72b137e + 8e5120e commit 659aad7

File tree

46 files changed

+297
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+297
-65
lines changed

algo-common/src/main/java/org/neo4j/gds/AlgorithmFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ default ALGO build(
6060
progressTask,
6161
log,
6262
configuration.concurrency(),
63+
configuration.jobId(),
6364
taskRegistryFactory,
6465
userLogRegistryFactory
6566
);

alpha/alpha-proc/src/test/java/org/neo4j/gds/KSpanningTreeProcTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void shouldTrackProgress() {
148148
TestProcedureRunner.applyOnProcedure(db, KSpanningTreeMaxProc.class, proc -> {
149149
var taskStore = new GlobalTaskStore();
150150

151-
proc.taskRegistryFactory = () -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore));
151+
proc.taskRegistryFactory = jobId -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore, jobId));
152152
proc.nodePropertyExporterBuilder = new NativeNodePropertiesExporterBuilder(
153153
TransactionContext.of(proc.api, proc.procedureTransaction)
154154
);

alpha/alpha-proc/src/test/java/org/neo4j/gds/SpanningTreeProcTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void shouldTrackProgress() {
215215
TestProcedureRunner.applyOnProcedure(db, SpanningTreeProcMin.class, proc -> {
216216
var taskStore = new GlobalTaskStore();
217217

218-
proc.taskRegistryFactory = () -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore));
218+
proc.taskRegistryFactory = jobId -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore, jobId));
219219
proc.relationshipExporterBuilder = new NativeRelationshipExporterBuilder(
220220
TransactionContext.of(proc.api, proc.procedureTransaction)
221221
);

alpha/alpha-proc/src/test/java/org/neo4j/gds/centrality/HarmonicCentralityProcTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void testProgressTracking() {
115115
TestProcedureRunner.applyOnProcedure(db, HarmonicCentralityWriteProc.class, proc -> {
116116
var taskStore = new GlobalTaskStore();
117117

118-
proc.taskRegistryFactory = () -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore));
118+
proc.taskRegistryFactory = jobId -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore, jobId));
119119
proc.nodePropertyExporterBuilder = new NativeNodePropertiesExporterBuilder(
120120
TransactionContext.of(proc.api, proc.procedureTransaction)
121121
);

alpha/alpha-proc/src/test/java/org/neo4j/gds/scc/SccProcTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void testProgressTracking() {
147147
TestProcedureRunner.applyOnProcedure(db, SccWriteProc.class, proc -> {
148148
var taskStore = new GlobalTaskStore();
149149

150-
proc.taskRegistryFactory = () -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore));
150+
proc.taskRegistryFactory = jobId -> new NonReleasingTaskRegistry(new TaskRegistry(getUsername(), taskStore, jobId));
151151
proc.nodePropertyExporterBuilder = new NativeNodePropertiesExporterBuilder(
152152
TransactionContext.of(proc.api, proc.procedureTransaction)
153153
);

alpha/alpha-proc/src/test/java/org/neo4j/gds/userlog/UserLogProcTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.neo4j.gds.GdsCypher;
2828
import org.neo4j.gds.catalog.GraphProjectProc;
2929
import org.neo4j.gds.compat.Neo4jProxy;
30+
import org.neo4j.gds.core.utils.progress.JobId;
3031
import org.neo4j.gds.core.utils.progress.ProgressFeatureSettings;
3132
import org.neo4j.gds.core.utils.progress.TaskRegistryExtension;
3233
import org.neo4j.gds.core.utils.progress.TaskRegistryFactory;
@@ -217,7 +218,7 @@ public Stream<FakeResult> foo(
217218
) throws InterruptedException {
218219
var task = Tasks.task(taskName, Tasks.leaf("leaf", 3));
219220

220-
var taskProgressTracker = new TaskProgressTracker(task, Neo4jProxy.testLog(), 1, taskRegistryFactory,
221+
var taskProgressTracker = new TaskProgressTracker(task, Neo4jProxy.testLog(), 1, new JobId(), taskRegistryFactory,
221222
userLogRegistryFactory
222223
);
223224
taskProgressTracker.beginSubTask();

alpha/alpha-proc/src/test/java/org/neo4j/gds/walking/CollapsePathMutateProcTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,8 @@ void testMutateYields() {
157157
@Disabled
158158
@Override
159159
public void shouldUnregisterTaskAfterComputation() {}
160+
161+
@Disabled
162+
@Override
163+
public void shouldRegisterTaskWithCorrectJobId() {}
160164
}

core/src/main/java/org/neo4j/gds/config/AlgoBaseConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import java.util.List;
3232
import java.util.stream.Collectors;
3333

34-
public interface AlgoBaseConfig extends BaseConfig, ConcurrencyConfig {
34+
public interface AlgoBaseConfig extends BaseConfig, ConcurrencyConfig, JobIdConfig {
3535

3636
String NODE_LABELS_KEY = "nodeLabels";
3737
String RELATIONSHIP_TYPES_KEY = "relationshipTypes";

core/src/main/java/org/neo4j/gds/config/GraphProjectConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import static org.neo4j.gds.config.GraphProjectFromStoreConfig.NODE_PROJECTION_KEY;
3737
import static org.neo4j.gds.config.GraphProjectFromStoreConfig.RELATIONSHIP_PROJECTION_KEY;
3838

39-
public interface GraphProjectConfig extends BaseConfig {
39+
public interface GraphProjectConfig extends BaseConfig, JobIdConfig {
4040

4141
String IMPLICIT_GRAPH_NAME = "";
4242
String NODE_COUNT_KEY = "nodeCount";
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.config;
21+
22+
import org.immutables.value.Value;
23+
import org.neo4j.gds.annotation.Configuration;
24+
import org.neo4j.gds.core.utils.progress.JobId;
25+
26+
@Configuration
27+
public interface JobIdConfig {
28+
@Value.Default
29+
@Value.Parameter(false)
30+
@Configuration.ConvertWith("org.neo4j.gds.core.utils.progress.JobId#parse")
31+
@Configuration.ToMapValue("org.neo4j.gds.core.utils.progress.JobId#asString")
32+
default JobId jobId() {
33+
return new JobId();
34+
}
35+
}

0 commit comments

Comments
 (0)