From d590c451a03bc49f2fee7a4a36e4be20e8cc07fe Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Sat, 20 Jul 2024 04:49:55 +0200 Subject: [PATCH 1/2] Change `id` field passed to JobInfo from int to str fixes #29 The id field of JobInfo is expecting a str. In #24 when parsing JSON output of `hq job list` the json loads will use the int for the id parsed directly. Wrong type causes the subtle issue that when job is waiting it not get into QUEUED state, but immediatly finished and get nothing to parse from output. --- aiida_hyperqueue/scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida_hyperqueue/scheduler.py b/aiida_hyperqueue/scheduler.py index 7ac08b4..b2741e5 100644 --- a/aiida_hyperqueue/scheduler.py +++ b/aiida_hyperqueue/scheduler.py @@ -228,7 +228,7 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list: job_info_list = [] for hq_job_dict in hq_job_info_list: job_info = JobInfo() - job_info.job_id = hq_job_dict["id"] + job_info.job_id = str(hq_job_dict["id"]) # must be str, if it is a int job will not waiting job_info.title = hq_job_dict["name"] stats: t.List[str] = [ stat for stat, v in hq_job_dict["task_stats"].items() if v > 0 From ca89635b8c83fc5e13adc3d562f6ef2b4bb093e4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 02:50:26 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- aiida_hyperqueue/scheduler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aiida_hyperqueue/scheduler.py b/aiida_hyperqueue/scheduler.py index b2741e5..5523b7f 100644 --- a/aiida_hyperqueue/scheduler.py +++ b/aiida_hyperqueue/scheduler.py @@ -228,7 +228,9 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list: job_info_list = [] for hq_job_dict in hq_job_info_list: job_info = JobInfo() - job_info.job_id = str(hq_job_dict["id"]) # must be str, if it is a int job will not waiting + job_info.job_id = str( + hq_job_dict["id"] + ) # must be str, if it is a int job will not waiting job_info.title = hq_job_dict["name"] stats: t.List[str] = [ stat for stat, v in hq_job_dict["task_stats"].items() if v > 0