we have the idea to give our users the possibility to create a ram disk for their jobs as a custom ressource. Currently our idea is to use the prologue to create it as root and give the user access to it. But it is not possible to track memory usage with the ram disk included.
Does anybody have an idea?
You may be able to track it with cgroups but I have not tried it myself. I think it is worth a try.
Since the RAM disk will be created by a process that is independent of the job itself, the memory usage will not be associated with the session ID or within the cgroups hierarchy. Presumably, you’ll need a custom resource (e.g. ramdisk_mb) in order for users to request some amount of RAM disk space, and so that your prologue knows how large a disk to create. You should be able to record this information as resources_used.ramdisk_mb from a hook so that it appears in the accounting string. You may also want to consider creating the RAM disk itself from a hook as opposed to a prologue script if you are comfortable with Python. We would certainly consider adding it to our hooks collection so that others may take advantage of it.