From c1bf0347b0735b791b1e42308ad4fda584f1efc1 Mon Sep 17 00:00:00 2001 From: sclaw Date: Fri, 8 Nov 2024 16:32:00 -0500 Subject: [PATCH] fix job html rendering --- MANIFEST.in | 3 ++- ripple1d/api/app.py | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 214d5550..c6395c32 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ -exclude production/* \ No newline at end of file +include ripple1d\api\templates\* +recursive-include ripple1d\api\static\ * diff --git a/ripple1d/api/app.py b/ripple1d/api/app.py index 7ef741a8..017a2157 100644 --- a/ripple1d/api/app.py +++ b/ripple1d/api/app.py @@ -131,8 +131,7 @@ def test(): @app.route("/jobs", methods=["GET"]) def jobs(): """Retrieve OGC status and result for all jobs.""" - # try: - format_option = request.args.get("f") + format_option = request.args.get("f", default="json") task2metadata = tasks.task_status(only_task_id=None) jobs = [get_job_status(task_id, huey_metadata) for task_id, huey_metadata in task2metadata.items()] response = {"jobs": jobs} @@ -273,7 +272,9 @@ def parse_request_param__bool(param_name: str, default: bool) -> tuple[bool, tup ) -def get_job_status(task_id: str, huey_metadata: dict, return_result: bool = False, include_traceback: bool = False) -> dict: +def get_job_status( + task_id: str, huey_metadata: dict, return_result: bool = False, include_traceback: bool = False +) -> dict: """Convert huey-style task status metadata into a OGC-style job summary dictionary.""" out_dict = { "jobID": task_id, @@ -282,9 +283,9 @@ def get_job_status(task_id: str, huey_metadata: dict, return_result: bool = Fals "processID": huey_metadata["func_name"], } if return_result: - if not include_traceback and huey_metadata['result'] is not None: - del huey_metadata['result']['tb'] - out_dict["result"] = huey_metadata['result'] + if not include_traceback and huey_metadata["result"] is not None: + del huey_metadata["result"]["tb"] + out_dict["result"] = huey_metadata["result"] return out_dict