Skip to content

Commit

Permalink
Engine: only call get_detailed_job_info if there is a job id (#4967)
Browse files Browse the repository at this point in the history
In the retrieve task of `CalcJobs` the `get_detailed_job_info` was
called always. This would lead to problems if the node did not have an
associated job id. Normally this doesn't happen because without a job id
the engine would not even have been able to confirm that the job was
ready for retrieval, however, this can happen in artificial situations
where the whole calcjob process is mocked and for example an already
completed job is passed through the system.

When there is no job id, the `get_detailed_job_info` method should not
be called because it requires the job id to get any information. Without
it, the method would except and since it is called within the
exponential backoff mechanism, the job would get stuck in the paused
state.
  • Loading branch information
ramirezfranciscof authored Jul 21, 2021
1 parent da179dc commit 2d51386
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions aiida/engine/processes/calcjobs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ async def do_retrieve():
scheduler = node.computer.get_scheduler() # type: ignore[union-attr]
scheduler.set_transport(transport)

if node.get_job_id() is None:
logger.warning(f'there is no job id for CalcJobNoe<{node.pk}>: skipping `get_detailed_job_info`')
return execmanager.retrieve_calculation(node, transport, retrieved_temporary_folder)

try:
detailed_job_info = scheduler.get_detailed_job_info(node.get_job_id())
except FeatureNotAvailable:
Expand Down

0 comments on commit 2d51386

Please sign in to comment.