From a7adee226e74062d5517c366a7a54eec7b59238c Mon Sep 17 00:00:00 2001 From: Sonia Zorba Date: Tue, 1 Jul 2025 12:32:38 +0200 Subject: [PATCH] Bump fractal-web v1.19.1 and adapted create_tasks_data.py --- fractal-web-reference.txt | 2 +- tasks_data_retrieval/create_tasks_data.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fractal-web-reference.txt b/fractal-web-reference.txt index 8cc47ae..b620d36 100644 --- a/fractal-web-reference.txt +++ b/fractal-web-reference.txt @@ -1 +1 @@ -v1.13.1 +v1.19.1 diff --git a/tasks_data_retrieval/create_tasks_data.py b/tasks_data_retrieval/create_tasks_data.py index 7a0a80c..ed8d035 100644 --- a/tasks_data_retrieval/create_tasks_data.py +++ b/tasks_data_retrieval/create_tasks_data.py @@ -238,7 +238,7 @@ def _get_task_type( sources = f.read().splitlines() sources = [source for source in sources if not (source.startswith("#") or source == "")] -TASK_GROUPS = [] +task_groups = [] for source in sources: t_start = time.perf_counter() print(f"START processing {source=}") @@ -274,7 +274,7 @@ def _get_task_type( TaskGroupReadV2(**task_group) - TASK_GROUPS.append(task_group) + task_groups.append(task_group) t_end = time.perf_counter() print( @@ -285,8 +285,20 @@ def _get_task_type( ) print() +# grouping results +GROUPED_RESULT = [] + +for task_group in task_groups: + if any(existing_pkg_name == task_group["pkg_name"] for existing_pkg_name, _ in GROUPED_RESULT): + raise ValueError(f"Duplicate package name found: {task_group['pkg_name']}") + + GROUPED_RESULT.append((task_group["pkg_name"], [task_group])) + +# sort by package name +GROUPED_RESULT.sort(key=lambda x: x[0].lower()) + output_file = Path(__file__).parent / "tasks.json" with output_file.open("w") as f: - json.dump(TASK_GROUPS, f, indent=2) + json.dump(GROUPED_RESULT, f, indent=2) DOWNLOAD_FOLDER.rmdir()