status.check() fails with "duplicate 'row.names'" when a module appears twice in STATUS

Aperta Adatta ai principianti
#4,253 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
r
Ambito
backend

Direzione di ricerca

Inizia leggendo status.check() e le funzioni status.start() e status.end() nel pacchetto PEcAn.utils per vedere come vengono scritti e letti i record STATUS. Aggiungi o esegui un test che ripeta una voce del modulo e verifichi il risultato sia per quel modulo sia per un modulo assente. Il lavoro è completato quando status.check() restituisce il valore di stato documentato senza fallire in presenza di record duplicati, usando il record più recente per il modulo richiesto.

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

Descrizione

Summary

PEcAn.utils::status.check() reads the STATUS file with read.table(row.names = 1). status.start() and status.end() only append to the file, so a module that is started twice (for example when a workflow is rerun in the same outdir without clearing STATUS) appears twice, and status.check() then stops with an error instead of returning 0, 1 or -1.

Reproduction (on develop)

library(PEcAn.utils)
f <- tempfile()
status.start("A", f); status.end("DONE", f)
status.start("A", f); status.end("ERROR", f)
status.check("A", f)
#> Error in read.table(...): duplicate 'row.names' are not allowed
status.check("B", f)   # fails the same way: the error comes from reading the whole file

Impact

status.check() is called by do_conversions() (status.check(name) == 0) and by several workflow scripts and vignettes. The docs say the status functions should not produce errors of their own, and that status.check() returns 0, 1 or -1.

Proposed fix

Read the file without row.names, and use the most recent record for the requested module (STATUS is an append-only log). It also removes a no-op status_data[name, ] line. I have a branch ready with a small test that fails on develop and passes with the fix; happy to send a PR if wanted

Lingua principale
R
Stelle
246
Fork
322
Merge medio
4g 15h
PR unite (30g)
15

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 PecanProject/pecan

Tutte le issue di PecanProject/pecan

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.