Commit 4469d95d authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

api endpoint to remove large file, and be able to re-run a project. purge png files

parent 501144ca
......@@ -270,6 +270,10 @@ class Project(BaseModel, abc.ABC):
if os.path.exists(csv_path):
have_removed_file = True
os.remove(csv_path)
for filename in os.listdir(self.get_folder_path()):
if filename.endswith(".png"):
os.remove(os.path.join(self.get_folder_path(), filename))
have_removed_file = True
return have_removed_file
@call_with_tb('global_manhattan')
......
......@@ -35,9 +35,9 @@ else:
logging.info("/webui cannot be served as client/dist is missing, please build the client.")
def load_project(project_id):
def load_project(project_id, *args, **kargs):
try:
return project__load_project(project_id=project_id)
return project__load_project(project_id=project_id, *args, **kargs)
except FileNotFoundError:
raise HTTPException(status_code=404, detail="Project not found")
except JSONDecodeError as e:
......@@ -82,6 +82,11 @@ def project_detail(project_id: str):
return load_project(project_id=project_id).progress
@app.get("/api/projects/{project_id}/unload", response_model=bool)
def project_detail(project_id: str):
return load_project(project_id=project_id, flag_as_visited=False).delete_large_files()
@app.get("/api/projects/{project_id}/summary")
def project_detail(project_id: str):
return load_project(project_id=project_id).get_project_summary_statistics()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment