Commit Graph

3 Commits

Author SHA1 Message Date
Amy Wang 14ef810ad9 Image Optimization - Create new ImagePool for each batch (#470)
continuous-integration/drone/push Build is passing Details
We have been having issues with the image optimization script consuming egregious amounts of memory and failing CI as a result.

This PR changes the script so that we use a new `ImagePool` to process each batch of images.

Co-authored-by: Amy <a258wang@uwaterloo.ca>
Reviewed-on: #470
Reviewed-by: Shahan Neda <snedadah@csclub.uwaterloo.ca>
2022-06-28 22:54:20 -04:00
Amy Wang 443925190e Improve image optimization run-time and memory usage (#457)
continuous-integration/drone/push Build is passing Details
This PR aims to resolve the issues surrounding the optimize-images script, at least in the short term, in order to unblock other work.

**Problems:** Our optimize-images script was taking a very long time to run (~7 minutes in CI, when successful). This led to two problems:
1. It was near impossible to run the script locally.
2. CI jobs would often get killed on the optimize-images step.

**Solutions:**
1. Resize the images in `images/events` prior to optimizing them, similar to what is done for the images in `images/team`. This solution on its own reduced the run-time of the script to ~30 seconds locally on Amy's laptop, which is comparable to the run-time of the script back when it was originally written.
2. EDIT: Copy/resize/optimize the images in batches of 32 at a time. The reason why the CI job was being killed is because the script would run out of memory, however this change should resolve that while also keeping build times reasonable (~30 sec locally/when deploying on caffeine, ~3 min in CI). ~~As a temporary fix, this PR also replaces the images in `images/events` with their resized + optimized versions. (For some unknown reason, Solution 1 is not sufficient to solve Problem 2.)~~

This PR also adds some logging to the script so we can get a (slightly) better sense of where the script is getting stuck.

Related issue: #456

Co-authored-by: Amy <a258wang@uwaterloo.ca>
Reviewed-on: #457
Reviewed-by: Shahan Neda <snedadah@csclub.uwaterloo.ca>
2022-06-04 19:31:00 -04:00
Amy Wang aae5c9adef Image Optimization Script (#348)
continuous-integration/drone/push Build is passing Details
A build-time script to optimize images. Note that going forward, all images should be placed in `images` instead of `public/images`.

Co-authored-by: Amy <a258wang@uwaterloo.ca>
Reviewed-on: #348
Reviewed-by: Aditya Thakral <a3thakra@csclub.uwaterloo.ca>
Reviewed-by: n3parikh <n3parikh@csclub.uwaterloo.ca>
Co-authored-by: Amy <a258wang@csclub.uwaterloo.ca>
Co-committed-by: Amy <a258wang@csclub.uwaterloo.ca>
2021-10-31 16:58:14 -04:00