Skip to main content

A greedy processes sniper

Project description

A simple script to automatically kill greedy processes

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).

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.

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.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

tania-1.0.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tania-1.0.0.tar.gz
  • Upload date:
  • Size: 17.8 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.0.tar.gz
Algorithm Hash digest
SHA256 3821ff79c61d9d54c8c9912d43c0ba156d6628c7f0e5d0dc7be204492ad912a6
MD5 92bcd0266cb9bf0f28a6a3f756818ca9
BLAKE2b-256 eec1958abfdbfee24e9dc316f916d4b80f7445a2a3527d6f6a0feec193e5842b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tania-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e297bf493d1405268eaf9986dfbde32a1e912cbae8e9ff697d3934cec78abc4d
MD5 0802d64fc00cb23f709b9745213379f3
BLAKE2b-256 e734da9369f6d57009ce37b4d073d9fdb191db9bd7cb834930173825aea9b2c0

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