Skip to content

Commit bbb39f6

Browse files
committed
Add new param to cli for new pipeline
1 parent 5f69bc0 commit bbb39f6

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

graphrag/api/index.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
Backwards compatibility is not guaranteed at this time.
99
"""
1010

11+
import logging
12+
1113
from datashaper import WorkflowCallbacks
1214

1315
from graphrag.cache.noop_pipeline_cache import NoopPipelineCache
@@ -20,6 +22,8 @@
2022
from graphrag.index.typing import PipelineRunResult
2123
from graphrag.logger.base import ProgressLogger
2224

25+
log = logging.getLogger(__name__)
26+
2327

2428
async def build_index(
2529
config: GraphRagConfig,
@@ -28,7 +32,7 @@ async def build_index(
2832
memory_profile: bool = False,
2933
callbacks: list[WorkflowCallbacks] | None = None,
3034
progress_logger: ProgressLogger | None = None,
31-
use_new_pipeline: bool = False,
35+
new_pipeline: bool = False,
3236
) -> list[PipelineRunResult]:
3337
"""Run the pipeline with the given configuration.
3438
@@ -67,7 +71,8 @@ async def build_index(
6771
callbacks.append(create_pipeline_reporter(config.reporting, None)) # type: ignore
6872
outputs: list[PipelineRunResult] = []
6973

70-
if use_new_pipeline:
74+
if new_pipeline:
75+
log.info("RUNNING NEW WORKFLOWS WITHOUT DATASHAPER")
7176
async for output in run_workflows(
7277
config,
7378
cache=pipeline_cache,
@@ -83,6 +88,7 @@ async def build_index(
8388
progress_logger.success(output.workflow)
8489
progress_logger.info(str(output.result))
8590
else:
91+
log.info("RUNNING ORIGINAL PIPELINE")
8692
pipeline_config = create_pipeline_config(config)
8793
async for output in run_pipeline_with_config(
8894
pipeline_config,

graphrag/cli/index.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def index_cli(
7474
dry_run: bool,
7575
skip_validation: bool,
7676
output_dir: Path | None,
77+
new_pipeline: bool,
7778
):
7879
"""Run the pipeline with the given config."""
7980
config = load_config(root_dir, config_filepath)
@@ -88,6 +89,7 @@ def index_cli(
8889
dry_run=dry_run,
8990
skip_validation=skip_validation,
9091
output_dir=output_dir,
92+
new_pipeline=new_pipeline,
9193
)
9294

9395

@@ -124,6 +126,7 @@ def update_cli(
124126
dry_run=False,
125127
skip_validation=skip_validation,
126128
output_dir=output_dir,
129+
new_pipeline=False,
127130
)
128131

129132

@@ -137,6 +140,7 @@ def _run_index(
137140
dry_run,
138141
skip_validation,
139142
output_dir,
143+
new_pipeline,
140144
):
141145
progress_logger = LoggerFactory().create_logger(logger)
142146
info, error, success = _logger(progress_logger)
@@ -182,7 +186,7 @@ def _run_index(
182186
is_resume_run=bool(resume),
183187
memory_profile=memprofile,
184188
progress_logger=progress_logger,
185-
use_new_pipeline=True,
189+
new_pipeline=new_pipeline,
186190
)
187191
)
188192
encountered_errors = any(

graphrag/cli/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def _index_cli(
170170
resolve_path=True,
171171
),
172172
] = None,
173+
new: Annotated[bool, typer.Option(help="Use the new pipeline.")] = False,
173174
):
174175
"""Build a knowledge graph index."""
175176
from graphrag.cli.index import index_cli
@@ -185,6 +186,7 @@ def _index_cli(
185186
dry_run=dry_run,
186187
skip_validation=skip_validation,
187188
output_dir=output,
189+
new_pipeline=new,
188190
)
189191

190192

graphrag/index/run/run_workflows.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ async def run_workflows(
5858
run_id: str | None = None,
5959
) -> AsyncIterable[PipelineRunResult]:
6060
"""Run all workflows using a simplified pipeline."""
61-
log.info("RUNNING NEW WORKFLOWS WITHOUT DATASHAPER")
6261
start_time = time.time()
6362

6463
run_id = run_id or time.strftime("%Y%m%d-%H%M%S")

0 commit comments

Comments
 (0)