Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions graphgen/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@

import ray
import ray.data
from dotenv import load_dotenv
from ray.data import DataContext

from graphgen.bases import Config, Node
from graphgen.common import init_llm, init_storage
from graphgen.utils import logger

load_dotenv()


class Engine:
def __init__(
Expand Down
3 changes: 3 additions & 0 deletions graphgen/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

import ray
import yaml
from dotenv import load_dotenv
from ray.data.block import Block
from ray.data.datasource.filename_provider import FilenameProvider

from graphgen.engine import Engine
from graphgen.operators import operators
from graphgen.utils import CURRENT_LOGGER_VAR, logger, set_logger

load_dotenv()

sys_path = os.path.abspath(os.path.dirname(__file__))


Expand Down
14 changes: 9 additions & 5 deletions webui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def run_graphgen(params: WebuiParams, progress=gr.Progress()):
"op_name": "generate",
"type": "map_batch",
"dependencies": ["partition"],
"save_output": True,
"execution_params": {"replicas": 1, "batch_size": 128},
"params": {
"method": params.mode,
Expand All @@ -168,14 +169,17 @@ def run_graphgen(params: WebuiParams, progress=gr.Progress()):
}
)

config = {"global_params": {"working_dir": working_dir}, "nodes": nodes}
config = {
"global_params": {
"working_dir": working_dir,
"graph_backend": "kuzu",
"kv_backend": "rocksdb",
Comment on lines +175 to +176
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The backend names kuzu and rocksdb are hardcoded here. For better maintainability, it's a good practice to define these as constants at the module level. This makes them easier to find, update, and reuse, and it also serves as documentation for the default choices.

For example, you could add this at the top of the file:

DEFAULT_GRAPH_BACKEND = "kuzu"
DEFAULT_KV_BACKEND = "rocksdb"

And then use these constants in the global_params dictionary.

},
"nodes": nodes,
}

try:
# 4. Initialize and Run Engine
# Initialize Ray if not already running (Engine handles this mostly, but good for safety)
if not ray.is_initialized():
ray.init(ignore_reinit_error=True, log_to_driver=True)

engine = Engine(config, operators)

# Start with an empty dataset to kick off the pipeline
Expand Down
Loading