graph-data-science-client icon indicating copy to clipboard operation
graph-data-science-client copied to clipboard

Optional Logging for Graph Data Science Project.

Open angelosantos4 opened this issue 5 months ago • 2 comments

Is your feature request related to a problem? Please describe.

I am configuring logging for my automated graph data science project, and I noticed that there is no way to disable to the tqdm output that comes from the graph database runner. This has caused problems related to conflicting context when implementing my own Json Logger. I have located the logic that would allow this to be configurable to the end user here.

Describe the solution you would like

I would like for a parameter to be added to GraphProjectRunner.call for the logging variable, and for it to be propagated down to the query runner.

Describe alternatives you have considered

Since this logging variable is hard coded to be True when passed into the query runner, I am unable to get past this without manually modifying the library. I could directly create a Neo4jQueryRunner class and run the call_procedure with all the parameters necessary including logging=False, but I believe this is a simple enough change to propagate to a higher level.

Additional context

Suggested Change:

graphdatascience/graph/graph_project_runner.py

class GraphProjectRunner(IllegalAttrChecker):
    def __call__(self, graph_name: str, node_spec: Any, relationship_spec: Any, **config: Any) -> GraphCreateResult:
        params = CallParameters(
            graph_name=graph_name,
            node_spec=node_spec,
            relationship_spec=relationship_spec,
            config=config,
        )
        result = self._query_runner.call_procedure(
            endpoint=self._namespace,
            params=params,
            logging=True,
        ).squeeze()

        return GraphCreateResult(Graph(graph_name, self._query_runner), result)

Into

class GraphProjectRunner(IllegalAttrChecker):
    def __call__(self, graph_name: str, node_spec: Any, relationship_spec: Any, logging=True, **config: Any) -> GraphCreateResult:
        params = CallParameters(
            graph_name=graph_name,
            node_spec=node_spec,
            relationship_spec=relationship_spec,
            config=config,
        )
        result = self._query_runner.call_procedure(
            endpoint=self._namespace,
            params=params,
            logging=logging,
        ).squeeze()

        return GraphCreateResult(Graph(graph_name, self._query_runner), result)

angelosantos4 avatar Sep 23 '24 19:09 angelosantos4