-
Notifications
You must be signed in to change notification settings - Fork 214
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
Move getting completed job accounting to retrieve
transport task
#3639
Conversation
73709c1
to
b81f5a6
Compare
There was a problem hiding this 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
aiida/schedulers/scheduler.py
Outdated
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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? |
b81f5a6
to
8d2cfe6
Compare
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.
8d2cfe6
to
661b57c
Compare
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.
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.
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 detailedjob info each update cycle where it not for a conditional that checked
that the scheduler status was
DONE
. However, within theJobsList
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 reportsthat 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.