From 25531d447bd3e42962b3271f4e226432b804ca2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?june=2Ekim=28=EA=B9=80=EC=A4=80=ED=98=B8=29/kakao?= Date: Wed, 25 Sep 2024 23:55:17 +0900 Subject: [PATCH] Implements reports directory argument to CLI Implements `--reports` argument to the CLI, allowing users to specify a dedicated directory for reports. This enhances the flexibility of the pipeline configuration and decouples report directory management from output directory settings. The `--reports` argument was mentioned in the documentation at https://github.com/microsoft/graphrag/blob/dda4edd0fd2ad2665045a1689f14e68a198d6a7a/docsite/posts/index/2-cli.md?plain=1#L28, but had not been implemented. --- graphrag/index/__main__.py | 8 ++++++++ graphrag/index/cli.py | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/graphrag/index/__main__.py b/graphrag/index/__main__.py index 203d955872..f5727062cd 100644 --- a/graphrag/index/__main__.py +++ b/graphrag/index/__main__.py @@ -95,6 +95,13 @@ default=None, type=str, ) + parser.add_argument( + "--reports", + help="The reports directory to use for the pipeline.", + required=False, + default=None, + type=str, + ) args = parser.parse_args() if args.resume and args.update_index: @@ -115,4 +122,5 @@ init=args.init, skip_validations=args.skip_validations, output_dir=args.output, + reports_dir=args.reports, ) diff --git a/graphrag/index/cli.py b/graphrag/index/cli.py index 7dfae5b2cf..c8b8985b8a 100644 --- a/graphrag/index/cli.py +++ b/graphrag/index/cli.py @@ -116,6 +116,7 @@ def index_cli( dryrun: bool, skip_validations: bool, output_dir: str | None, + reports_dir: str | None, ): """Run the pipeline with the given config.""" progress_reporter = load_progress_reporter(reporter) @@ -130,7 +131,7 @@ def index_cli( config = load_config(root, config_filepath) config.storage.base_dir = output_dir or config.storage.base_dir - config.reporting.base_dir = output_dir or config.reporting.base_dir + config.reporting.base_dir = reports_dir or config.reporting.base_dir resolve_paths(config, run_id) if nocache: