Skip to content

Commit

Permalink
Add detailed_job_info
Browse files Browse the repository at this point in the history
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 <id>` 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`.
  • Loading branch information
t-reents committed Jul 17, 2024
1 parent 2cfabba commit ab17e92
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aiida_hyperqueue/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,15 @@ def _parse_joblist_output(self, retval: int, stdout: str, stderr: str) -> list:

return job_info_list

def _get_detailed_job_info_command(self, job_id):
"""Return the command to run to get the detailed information on a job,
even after the job has finished.
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 ."

def _get_kill_command(self, jobid):
"""Return the command to kill the job with specified jobid."""
submit_command = f"hq job cancel {jobid}"
Expand Down

0 comments on commit ab17e92

Please sign in to comment.