Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

codecarbon monitor prints a "Saved to" path that ignores output_dir

Aperta Adatta ai principianti
#1,322 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@davidberenstein1957 ci sta già lavorando.

Dal 12/8/2026.

  • #1331 di @davidberenstein1957 — aperta
  • #1409 di @sohammishra864-wq — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia da codecarbon/cli/monitor.py:119-125 e segui la configurazione di output_file e output_dir fino a codecarbon/output_methods/file.py:49-52. Riproduci il comando monitor con CODECARBON_OUTPUT_DIR impostato, quindi verifica che il report mostri il percorso CSV effettivo e ometta il percorso quando l'output CSV è disabilitato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The post-run report printed by codecarbon monitor -- <cmd> resolves the emissions file path from the file name only, so whenever output_dir is not the current working directory the CLI tells the user to look in the wrong place.

Reproduction

cd /home/user
CODECARBON_OUTPUT_DIR=/var/log/codecarbon codecarbon monitor -- ./train.sh

Prints:

   Saved to: /home/user/emissions.csv

while the CSV was actually written to /var/log/codecarbon/emissions.csv. Same happens with output_dir set in .codecarbon.config.

Root cause

codecarbon/cli/monitor.py:119-125 uses tracker._conf["output_file"] and calls os.path.abspath() on it. But output_file is only the basename (default "emissions.csv", codecarbon/emissions_tracker.py:567); the directory lives in a separate key output_dir (emissions_tracker.py:566). The two are joined only inside FileOutput (codecarbon/output_methods/file.py:49). os.path.abspath therefore resolves the bare name against the CWD, which is correct only for the default output_dir=".".

FileOutput does log the correct absolute path at construction (output_methods/file.py:50-52), but the CLI defaults to log_level="error" (cli/main.py, forwarded at cli/monitor.py:54), so that INFO line is suppressed and the wrong path is the only thing the user sees.

Expected vs actual

  • Expected: the report shows the path the CSV was actually written to (and shows nothing when CSV output is disabled).
  • Actual: <cwd>/emissions.csv, unconditionally, even when no file output handler exists.

Display-only defect; measurement and file writing are unaffected.

Lingua principale
Python
Stelle
1.9k
Fork
335
Merge medio
16h 47m
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mlco2/codecarbon

Tutte le issue di mlco2/codecarbon

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.