Skip to content

Commit

Permalink
create private modules to host system monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
lassewesth committed Aug 2, 2024
1 parent f6aeaa6 commit 788b07c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,24 @@ public Lifecycle newInstance(ExtensionContext extensionContext, Dependencies dep
var modelCatalog = new OpenModelCatalogProvider().get(null);

var graphSageModelRepository = new DisableGraphSageModelRepository(); // no model storing in OpenGDS
return GraphDataScienceExtensionBuilder.create(

var neo4jConfiguration = dependencies.config();

var graphDataScienceExtensionBuilderAndAssociatedProducts = GraphDataScienceExtensionBuilder.create(
log,
dependencies.config(),
neo4jConfiguration,
dependencies.globalProcedures(),
Optional.empty(), // no extra checks in OpenGDS
Optional.empty(), // no extra checks in OpenGDS
exporterBuildersProviderService,
metricsFacade,
modelCatalog,
dependencies.config(),
graphSageModelRepository
).build();
);

var graphDataScienceExtensionBuilder = graphDataScienceExtensionBuilderAndAssociatedProducts.getLeft();

return graphDataScienceExtensionBuilder.build();
}

public interface Dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
*/
package org.neo4j.gds.procedures;

import org.neo4j.configuration.Config;
import org.neo4j.gds.core.write.ExportBuildersProvider;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.config.Configuration;

public interface ExporterBuildersProviderService {
ExportBuildersProvider identifyExportBuildersProvider(GraphDatabaseService graphDatabaseService, Config config);
ExportBuildersProvider identifyExportBuildersProvider(GraphDatabaseService graphDatabaseService, Configuration neo4jConfiguration);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.gds.procedures.integration;

import org.neo4j.configuration.Config;
import org.apache.commons.lang3.tuple.Pair;
import org.neo4j.gds.applications.algorithms.embeddings.GraphSageModelRepository;
import org.neo4j.gds.applications.algorithms.machinery.AlgorithmProcessingTemplate;
import org.neo4j.gds.applications.graphstorecatalog.CatalogBusinessFacade;
Expand Down Expand Up @@ -80,7 +80,7 @@ private GraphDataScienceExtensionBuilder(
ModelCatalog modelCatalog,
TaskStoreService taskStoreService,
TaskRegistryFactoryService taskRegistryFactoryService,
Boolean useMaxMemoryEstimation,
boolean useMaxMemoryEstimation,
UserLogServices userLogServices,
Lifecycle gcListener
) {
Expand All @@ -100,7 +100,7 @@ private GraphDataScienceExtensionBuilder(
* We want to build a GDS, we receive a few customisations and are able to read configuration,
* and all the rest of the machinery goes here
*/
public static GraphDataScienceExtensionBuilder create(
public static Pair<GraphDataScienceExtensionBuilder, TaskStoreService> create(
Log log,
Configuration neo4jConfiguration,
GlobalProcedures globalProcedures,
Expand All @@ -109,7 +109,6 @@ public static GraphDataScienceExtensionBuilder create(
ExporterBuildersProviderService exporterBuildersProviderService,
MetricsFacade metricsFacade,
ModelCatalog modelCatalog,
Config config,
GraphSageModelRepository graphSageModelRepository
) {
// Read some configuration used to select behaviour
Expand Down Expand Up @@ -153,11 +152,11 @@ public static GraphDataScienceExtensionBuilder create(
memoryGauge,
metricsFacade,
modelCatalog,
config,
neo4jConfiguration,
graphSageModelRepository
);

return new GraphDataScienceExtensionBuilder(
var graphDataScienceExtensionBuilder = new GraphDataScienceExtensionBuilder(
log,
componentRegistration,
graphDataScienceProviderFactory,
Expand All @@ -169,6 +168,8 @@ public static GraphDataScienceExtensionBuilder create(
userLogServices,
gcListener
);

return Pair.of(graphDataScienceExtensionBuilder, taskStoreService);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.procedures.integration;

import org.neo4j.configuration.Config;
import org.neo4j.function.ThrowingFunction;
import org.neo4j.gds.applications.algorithms.embeddings.GraphSageModelRepository;
import org.neo4j.gds.applications.algorithms.machinery.AlgorithmProcessingTemplate;
Expand Down Expand Up @@ -50,6 +49,7 @@
import org.neo4j.gds.procedures.UserAccessor;
import org.neo4j.gds.procedures.UserLogServices;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.config.Configuration;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
import org.neo4j.kernel.api.procedure.Context;

Expand Down Expand Up @@ -83,7 +83,7 @@ public class GraphDataScienceProvider implements ThrowingFunction<Context, Graph
private final TaskRegistryFactoryService taskRegistryFactoryService;
private final TaskStoreService taskStoreService;
private final UserLogServices userLogServices;
private final Config config;
private final Configuration neo4jConfiguration;
private final ModelCatalog modelCatalog;
private final GraphSageModelRepository graphSageModelRepository;

Expand All @@ -104,7 +104,7 @@ public class GraphDataScienceProvider implements ThrowingFunction<Context, Graph
TaskRegistryFactoryService taskRegistryFactoryService,
TaskStoreService taskStoreService,
UserLogServices userLogServices,
Config config,
Configuration neo4jConfiguration,
ModelCatalog modelCatalog,
GraphSageModelRepository graphSageModelRepository
) {
Expand All @@ -124,7 +124,7 @@ public class GraphDataScienceProvider implements ThrowingFunction<Context, Graph
this.taskRegistryFactoryService = taskRegistryFactoryService;
this.taskStoreService = taskStoreService;
this.userLogServices = userLogServices;
this.config = config;
this.neo4jConfiguration = neo4jConfiguration;
this.modelCatalog = modelCatalog;
this.graphSageModelRepository = graphSageModelRepository;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ public GraphDataScienceProcedures apply(Context context) throws ProcedureExcepti
private WriteContext constructWriteContext(Context context, GraphDatabaseService graphDatabaseService) {
var exportBuildersProvider = exporterBuildersProviderService.identifyExportBuildersProvider(
graphDatabaseService,
config
neo4jConfiguration
);

var exporterContext = new ExporterContext.ProcedureContextWrapper(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package org.neo4j.gds.procedures.integration;

import org.neo4j.configuration.Config;
import org.neo4j.gds.applications.algorithms.embeddings.GraphSageModelRepository;
import org.neo4j.gds.applications.algorithms.machinery.AlgorithmProcessingTemplate;
import org.neo4j.gds.applications.algorithms.machinery.DefaultMemoryGuard;
Expand All @@ -37,6 +36,7 @@
import org.neo4j.gds.procedures.ExporterBuildersProviderService;
import org.neo4j.gds.procedures.TaskRegistryFactoryService;
import org.neo4j.gds.procedures.UserLogServices;
import org.neo4j.graphdb.config.Configuration;

import java.util.Optional;
import java.util.function.Function;
Expand Down Expand Up @@ -64,7 +64,7 @@ final class GraphDataScienceProviderFactory {
private final MemoryGauge memoryGauge;
private final MetricsFacade metricsFacade;
private final ModelCatalog modelCatalog;
private final Config config;
private final Configuration neo4jConfiguration;
private final GraphSageModelRepository graphSageModelRepository;

private GraphDataScienceProviderFactory(
Expand All @@ -75,7 +75,7 @@ private GraphDataScienceProviderFactory(
MemoryGauge memoryGauge,
MetricsFacade metricsFacade,
ModelCatalog modelCatalog,
Config config,
Configuration neo4jConfiguration,
GraphSageModelRepository graphSageModelRepository
) {
this.log = log;
Expand All @@ -85,7 +85,7 @@ private GraphDataScienceProviderFactory(
this.memoryGauge = memoryGauge;
this.metricsFacade = metricsFacade;
this.modelCatalog = modelCatalog;
this.config = config;
this.neo4jConfiguration = neo4jConfiguration;
this.graphSageModelRepository = graphSageModelRepository;
}

Expand Down Expand Up @@ -120,7 +120,7 @@ GraphDataScienceProvider createGraphDataScienceProvider(
taskRegistryFactoryService,
taskStoreService,
userLogServices,
config,
neo4jConfiguration,
modelCatalog,
graphSageModelRepository
);
Expand All @@ -134,7 +134,7 @@ static GraphDataScienceProviderFactory create(
MemoryGauge memoryGauge,
MetricsFacade metricsFacade,
ModelCatalog modelCatalog,
Config config,
Configuration neo4jConfiguration,
GraphSageModelRepository graphSageModelRepository
) {
return new GraphDataScienceProviderFactory(
Expand All @@ -145,7 +145,7 @@ static GraphDataScienceProviderFactory create(
memoryGauge,
metricsFacade,
modelCatalog,
config,
neo4jConfiguration,
graphSageModelRepository
);
}
Expand Down

0 comments on commit 788b07c

Please sign in to comment.