-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add overwrite option when generating preview images #1032
Add overwrite option when generating preview images #1032
Conversation
Hello @bhilbert4, Thank you for updating !
Comment last updated at 2022-08-30 20:09:47 UTC |
@mfixstsci @BradleySappington this is ready for review. I tested it on the test server and all looks well. I ran it on program 01068 both with and without the new I also removed a strange line from preview_images.py that was causing a crash. I'm not sure how that line got in there (or maybe, how it was not removed in a prior PR), but it was referencing |
pool = multiprocessing.Pool(processes=int(SETTINGS['cores'])) | ||
results = pool.map(process_program, program_list) | ||
results = pool.starmap(process_program, program_list) |
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.
Since each tuple will have the same second parameter in the list, you could use the program_list with map (instead of starmap), and just send overwrite as the 'y' parameter. This wouldn't change the functionality, just simplifies the code. This is fine as is, just giving feedback.
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.
I'm not sure I understand. map() only accepts one parameter, right? So in that case I'd have to also make program_list a tuple, and I'd have to change the parameters of process_program() such that it accepts a single parameter that is then broken out into program id and overwrite status, right? Or am I misinterpreting the way that map() works?
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.
I withdraw my comment, Map can take multiple parameters, but they both need to be iterable anyway, this way makes more sense.
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.
minor comments, nothing critical
This PR adds an
overwrite
option to generate_preview_images.py, which will allow existing preview images and thumbnail images to be re-created and overwritten in cases where they already exist. This will make it easier to regenerate preview images, since we won't have to go in and manually delete them prior to running the code. This will also eliminate the time where a particular file has no preview image, which is currently the case between the time when the old image is deleted and the new image is generated.