From 35c73f21a719acf84716b68f54c1f8ccd4e88feb Mon Sep 17 00:00:00 2001 From: t-reents Date: Wed, 10 Jul 2024 15:08:55 +0200 Subject: [PATCH] Add detailed_job_info Here, I add the command to retrieve the `detailed_job_info`, which wasn't implemented before. This caused jobs run with HQ have no information about the job in their attributes. The `hq job info ` command is used and transformed into a one-line JSON string using jq. This string is stored in the attributes and can be transformed into a proper dictionary using `json.loads`. --- aiida_hyperqueue/scheduler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aiida_hyperqueue/scheduler.py b/aiida_hyperqueue/scheduler.py index 410a4b1..5b31b2f 100644 --- a/aiida_hyperqueue/scheduler.py +++ b/aiida_hyperqueue/scheduler.py @@ -277,6 +277,10 @@ def _parse_kill_output(self, retval, stdout, stderr): return True def _get_detailed_job_info_command(self, job_id: str) -> dict[str, t.Any]: - """hq command to get the detailed job info.""" + """Return the command to run to get the detailed information on a job, + even after the job has finished. - # TODO: implement me to get walltime issue etc + The output text is just retrieved, and returned for logging purposes. + `jq` is used to transform the json into a one-line string. + """ + return f"hq job info {job_id} --output-mode json | jq -c ."