WeBWorK Main Forum

remove_stale_images

Re: remove_stale_images

by John Jones -
Number of replies: 0
Hi,

Mike is right that my main concern at the time was images for equations. The situation for equation images and other tmp images is a little different, but worth dealing with.

Webwork caches equation images on the grounds that an image made today might be accessed again in a week or a month, etc. They are not tied to a particular course or user. Some of them are for things like $x$ and $y$ which probably get accessed every day, so you pretty much never want to regenerate them. So, remove_stale_images will let you remove those images based on the last time they were accessed. Some more exotic equation image may in fact exist because of one seed for some problem, and after a month it is probably not going to be used again. So, you can save on disk space by cleaning out images which haven't been used in a while.

The contents of html/tmp are basically intended to be used once (e.g., which you generate hardcopy). There may be exceptions (it is possible that webwork does not regenerate an on-the-fly graphics image if one already exists; then again, it might just regenerate anyway), but these don't get used very often. Anyway, the expected time frame for which the image is useful will be much shorter. It would make sense to have a daily cron job which wipes out any files in html/tmp/* which have not been accessed within the last hour. So, the time limit for html/tmp should be controlled separately from the time limit for the equation cache. It might be easier to do this through a separate utility. I have one, but it would need a little improvement for general usage (it has the path to the courses directory as a variable, but with the value hard-wired, whereas it should figure this out itself). If people want it, I can upload it into webwork, and then let someone else sort out that last detail.

Ideally, I guess webwork should have a file which can be executed by cron on a daily basis. One would set parameters in global.conf for things like how long to keep equation images and html/tmp (based on access time), and the initial webwork installation process would install the one cron job.

John