Skip to content

Commit 7b3dd10

Browse files
lchoquelclaude
andcommitted
fix: per-registry CSV path in generate_report
Move get_incremental_file_path() inside the loop so each registry writes to its own numbered CSV instead of overwriting a single shared path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7b123da commit 7b3dd10

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

pipelex/reporting/reporting_manager.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,9 @@ def report_inference_job(self, inference_job: InferenceJobAbstract):
367367

368368
@override
369369
def generate_report(self, pipeline_run_id: str | None = None, print_to_console: bool = True):
370-
cost_report_file_path: Path | None = None
371-
if self._reporting_config.is_generate_cost_report_file_enabled:
370+
is_csv_enabled = self._reporting_config.is_generate_cost_report_file_enabled
371+
if is_csv_enabled:
372372
ensure_path(self._reporting_config.cost_report_dir_path)
373-
cost_report_file_path = get_incremental_file_path(
374-
base_path=self._reporting_config.cost_report_dir_path,
375-
base_name=self._reporting_config.cost_report_base_name,
376-
extension=self._reporting_config.cost_report_extension,
377-
)
378373

379374
registries_to_process: dict[str, UsageRegistry] = {}
380375
if pipeline_run_id:
@@ -383,6 +378,13 @@ def generate_report(self, pipeline_run_id: str | None = None, print_to_console:
383378
registries_to_process = self._usage_registries
384379

385380
for run_id, registry in registries_to_process.items():
381+
cost_report_file_path: Path | None = None
382+
if is_csv_enabled:
383+
cost_report_file_path = get_incremental_file_path(
384+
base_path=self._reporting_config.cost_report_dir_path,
385+
base_name=self._reporting_config.cost_report_base_name,
386+
extension=self._reporting_config.cost_report_extension,
387+
)
386388
CostRegistry.generate_report(
387389
pipeline_run_id=run_id,
388390
tokens_usages=registry.get_current_tokens_usage(),

0 commit comments

Comments
 (0)