Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move getting completed job accounting to retrieve transport task #3639

Merged
merged 2 commits into from
Dec 10, 2019

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Dec 10, 2019

Fixes #3133

The task of retrieving the detailed accounting info from the scheduler
for completed jobs was erroneously placed within the scheduler status
update cycle of the JobsList. This would have requested the detailed
job info each update cycle where it not for a conditional that checked
that the scheduler status was DONE. However, within the JobsList
loop, completed jobs would not even appear in the result and hence the
conditional would never be hit. This caused the detailed accounting
never to be retrieved.

A logically better place for this functionality is in the retrieve
transport task after the UPDATE task, i.e. when the scheduler reports
that the job has terminated. The job accounting will query the scheduler
for the full accounting which, when implemented for the given scheduler
plugin, will be stored as an attribute on the calculation job node.

@sphuber sphuber force-pushed the fix_3133_detailed_calcjob_info branch 2 times, most recently from 73709c1 to b81f5a6 Compare December 10, 2019 18:57
Copy link
Member

@giovannipizzi giovannipizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small change before approval

def get_detailed_jobinfo(self, jobid):
"""
Return a string with the output of the detailed_jobinfo command.

.. deprecated:: use the `get_detailed_job_info` instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we declare when we drop this (2.0) and issue a warning in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@giovannipizzi
Copy link
Member

Actually, a second comment - here we're writing job_info with an underscore since it's a new key anyway. What to do we do with the old one? Am I allowed to just replace it with an underscore when I change from string to dict?

@sphuber sphuber force-pushed the fix_3133_detailed_calcjob_info branch from b81f5a6 to 8d2cfe6 Compare December 10, 2019 21:24
@sphuber
Copy link
Contributor Author

sphuber commented Dec 10, 2019

Actually, a second comment - here we're writing job_info with an underscore since it's a new key anyway. What to do we do with the old one? Am I allowed to just replace it with an underscore when I change from string to dict?

I think that if you change the attribute key, we should add a migration. I am not sure if it is worth the effort but feel free to add it if you prefer the consistency in the attribute keys

The task of retrieving the detailed accounting info from the scheduler
for completed jobs was erroneously placed within the scheduler status
update cycle of the `JobsList`. This would have requested the detailed
job info each update cycle where it not for a conditional that checked
that the scheduler status was `DONE`. However, within the `JobsList`
loop, completed jobs would not even appear in the result and hence the
conditional would never be hit. This caused the detailed accounting
never to be retrieved.

A logically better place for this functionality is in the `retrieve`
transport task after the `UPDATE` task, i.e. when the scheduler reports
that the job has terminated. The job accounting will query the scheduler
for the full accounting which, when implemented for the given scheduler
plugin, will be stored as an attribute on the calculation job node.

The `Scheduler.get_detailed_jobinfo` method is deprecated in favour of
the `Scheduler.get_detailed_job_info`. The former was returning a string
with the return value, stdout and stderr formatted within it, which is
not very flexible. The replacing method returns a dictionary.
This is useful for future implementation of a method that can parse the
string output into a dictionary.
@sphuber sphuber force-pushed the fix_3133_detailed_calcjob_info branch from 8d2cfe6 to 661b57c Compare December 10, 2019 21:57
@sphuber sphuber merged commit 91016b9 into aiidateam:develop Dec 10, 2019
@sphuber sphuber deleted the fix_3133_detailed_calcjob_info branch December 10, 2019 22:14
sphuber pushed a commit to giovannipizzi/aiida-core that referenced this pull request Dec 13, 2019
For historical reasons, this field was stored as a JSON-serialized
string in the `last_jobinfo` attribute of a CalcJob. However, this
is cumbersome and makes querying very hard.

We now replace this with a dictionary, thanks to new commands to
get directly a dictionary (with serialized fields, so that the
dictionary is JSON-serializable). These (and existing) methods of
the JobInfo class are now also tested.

Finally, the attribute key has been renamed from `last_jobinfo` to
`last_job_info`, for consistency with the key `detailed_job_info`
introduced in aiidateam#3639. By changing the type of the content, the field is
anyway not directly usable as before in scripts, so changing the name
is not an additional issue. This should not give a real backward-
incompatibility problem, since this field was there mostly for
debugging reasons.
sphuber pushed a commit that referenced this pull request Dec 13, 2019
For historical reasons, this field was stored as a JSON-serialized
string in the `last_jobinfo` attribute of a CalcJob. However, this
is cumbersome and makes querying very hard.

We now replace this with a dictionary, thanks to new commands to
get directly a dictionary (with serialized fields, so that the
dictionary is JSON-serializable). These (and existing) methods of
the JobInfo class are now also tested.

Finally, the attribute key has been renamed from `last_jobinfo` to
`last_job_info`, for consistency with the key `detailed_job_info`
introduced in #3639. By changing the type of the content, the field is
anyway not directly usable as before in scripts, so changing the name
is not an additional issue. This should not give a real backward-
incompatibility problem, since this field was there mostly for
debugging reasons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detailed job info for completed CalcJobs gets set to None
2 participants