Skip to main content

A greedy processes sniper

Project description

A greedy processes killer

Tania is a python script designed to kill processes that should not be there on a computing cluster's frontend, generally because users forgot (or do not know how to) launch their program into a proper job. You can customize which processes should be monitored (targets) and which should be whitelisted (allies), based on their name, owner, cputime and memory size (rss). Tania is designed to be run as a cron job.

Installation

Install tania:

git clone https://github.com/bzizou/tania
cd tania
pip install .

Copy tania.conf and tania_targets.json to an appropriate location, for example /etc, and customize those files. You can set up the $TANIA_CONF_FILE variable if you placed the config file into another location than /etc.

sudo cp etc/tania.conf /etc
sudo cp etc/tania_targets.json /etc
# Edit tania.conf and tania_targets.json
# WARNING: tania can kill system processes if not configured properly!

Usage

tania --help
Usage: tania [options]

Options:
  -h, --help     show this help message and exit
  -D, --do       Actualy do kill bad processes
  -v, --verbose  Be more verbose
  -m, --mail     Send an email to the familly of the deceased

By default, tania does nothing and only prints the PID of the processes that should be killed:

root@f-dahu:~# tania               
Warning: 1827444 is in the viewfinder 
Warning: 210765 is in the viewfinder  
Warning: 3317806 is in the viewfinder 

You can print more informations, to know the reasons of the kills:

root@dahu:~# tania -v
We should kill 1670118 ( yes ) of bzizou with cputime 4 (limit  1 )
We should kill 1666340 ( stress-ng-vm [run] ) of bzizou with memory 212292 (limit  200000 )

To actually kill the processes, use --do:

root@dahu:~# tania --do
Shooting down process 1670118

The --mail option will send an e-mail to the owner of the killed process using the mail templates from the config file.

Finally, Tania is meant to be run frequently from cron. Here's an example cron job configuration:

# cat /etc/cron.d/tania                                  
*/2 * * * * root tania --do --mail |grep -v Warning

Why this name "Tania" ?

Check https://en.wikipedia.org/wiki/Tania_Chernova

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tania-1.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

tania-1.0.1-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file tania-1.0.1.tar.gz.

File metadata

  • Download URL: tania-1.0.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for tania-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9c43aa35a99b61b0d3f7b2f477b8fdd5adb583e830de02e10f0e7d5be2e0b36f
MD5 8025c8ff59f34d820856cb0700e2b6fa
BLAKE2b-256 433772e2ecf06590676e9cbf2a1c44612005e70ee645d51aeb98543820aa598a

See more details on using hashes here.

File details

Details for the file tania-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: tania-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for tania-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5289efd16a1d35d7630f0ccfae0718e6299b4476f6d5159db7b0f9c2c72809d4
MD5 9ff22f689b737711eeee0a4b4a8710d0
BLAKE2b-256 344bfdc3c813dce626b3e149aef0fc2181bf4c70514254b40861d65cd01c60e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page