Skip to content

Import to help prevent your system crashing badly while doing EDA (or anything that accidentally uses memory)

License

Notifications You must be signed in to change notification settings

jbn/oom_reap_me_first

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

If you have something you are working on that may accidentally consume all your RAM (read: are a data scientist), you probably want your process OOM reaped before the other ones. What you absolutely do not want is something like process that may fail in a bad state getting reaped instead.

If you install this package with,

pip install oom_reap_me_first

then do,

import oom_reap_me_first.auto_enable # noqa # pylint: disable=unused-import

at the top of your, say, Jupyter notebook, the importing processes oom_score_adj will be set to 1000, which means it will (probably?) get reaped first.

This works particularly well if you disable swap, so you don't end up in the dreaded situation of your REPL taking all the RAM then hitting disk so hard that you can't even i-i it.

What else should I know?

The oom_score_adj that controls what gets preferentially gets killed can be configured automatically for systemd services. If you have something that you really don't want to get killed, you should put,

oom score -1000

in the service unit definition. Alternatively, if you are not using python you can use the choom (change-OOM) command

choom -p PID -n number

See the man page here.

However, I am lazy and my solution suits me better.

About

Import to help prevent your system crashing badly while doing EDA (or anything that accidentally uses memory)

Resources

License

Stars

Watchers

Forks

Packages

No packages published