Fix fallout-ingest: prefer v2 log, expose version field
This commit is contained in:
@@ -201,11 +201,16 @@ def get_fallout_ingest():
|
||||
try:
|
||||
with open("/data/fallout_state.json") as f: state=json.load(f)
|
||||
except: pass
|
||||
running = _log_running("/data/fallout_ingest.log")
|
||||
# Préfère le log v2 s'il existe, sinon log v1
|
||||
import os as _os
|
||||
log_v2 = "/data/fallout_ingest_v2.log"
|
||||
log_v1 = "/data/fallout_ingest.log"
|
||||
log_path = log_v2 if _os.path.exists(log_v2) else log_v1
|
||||
running = _log_running(log_path)
|
||||
current_pdf=None; current_chunk=None; total_chunks=None
|
||||
chunks_done=[]; log_tail=[]
|
||||
chunks_done=[]; log_tail=[]; version="v2" if log_path==log_v2 else "v1"
|
||||
try:
|
||||
with open("/data/fallout_ingest.log") as f: lines=f.readlines()
|
||||
with open(log_path) as f: lines=f.readlines()
|
||||
log_tail=[l.rstrip() for l in lines[-30:] if l.strip()]
|
||||
for l in reversed(lines):
|
||||
l=l.rstrip()
|
||||
@@ -218,7 +223,7 @@ def get_fallout_ingest():
|
||||
if m2: chunks_done.append(float(m2.group(1)))
|
||||
except: pass
|
||||
avg_t=round(sum(chunks_done)/len(chunks_done),1) if chunks_done else None
|
||||
return {"running":running,"done":len(state.get("ingested",[])),"failed":len(state.get("failed",[])),
|
||||
return {"running":running,"version":version,"done":len(state.get("ingested",[])),"failed":len(state.get("failed",[])),
|
||||
"total":17,"current_pdf":current_pdf if running else None,
|
||||
"current_chunk":current_chunk,"total_chunks":total_chunks,"avg_embed_s":avg_t,"log_tail":log_tail}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user