Update Python tools
This commit is contained in:
@@ -139,6 +139,7 @@ def create_app(settings: Settings | None = None) -> Flask:
|
||||
"run.html",
|
||||
run=run,
|
||||
children=store.children(run.id),
|
||||
output=read_run_output(run),
|
||||
)
|
||||
|
||||
@app.post("/runs/<int:run_id>/cancel")
|
||||
@@ -153,12 +154,15 @@ def create_app(settings: Settings | None = None) -> Flask:
|
||||
run = store.get(run_id)
|
||||
if run is None:
|
||||
abort(404)
|
||||
return {"output": read_run_output(run)}
|
||||
|
||||
def read_run_output(run) -> str:
|
||||
if not run.log_path:
|
||||
return {"output": ""}
|
||||
return ""
|
||||
try:
|
||||
return {"output": Path(run.log_path).read_text(encoding="utf-8", errors="replace")}
|
||||
return Path(run.log_path).read_text(encoding="utf-8", errors="replace")
|
||||
except FileNotFoundError:
|
||||
return {"output": ""}
|
||||
return ""
|
||||
|
||||
@app.get("/runs/<int:run_id>/artifacts")
|
||||
def run_artifacts(run_id: int):
|
||||
|
||||
Reference in New Issue
Block a user