-
Notifications
You must be signed in to change notification settings - Fork 15
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
remove unnecessary database queries #1324
Conversation
pyiron_base/project/generic.py
Outdated
if job_id not in self.get_job_ids(recursive=recursive): | ||
continue |
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.
If I understand this pull request correctly, then the primary change is removing this database query, correct? Maybe we should split this pull request in two parts. One containing just the removal of this part and the other the refactoring. Having both mixed makes it a bit hard to read.
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.
state.logger.debug( | ||
"hdf file does not exist. Removal from database will be attempted." | ||
) | ||
self.db.delete_item(job.id) |
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.
@jan-janssen You missed this line. It might not be called often but it is another redundant database query.
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.
But this is dangerous. For example when you create a job object and remove the HDF5 file, then the loading of the job object with inspect()
fails and returns an IOError
still in the except case the job object is not available, so we cannot use job.id
.
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.
Ok, I realised that the inspect()
function also works when the file is corrupted #1327
Improves performance of
remove_jobs
.