<commit_before># tractor-purge

### What's this?

Purge task logs from [Pixar's Tractor](https://renderman.pixar.com/view/pixars-tractor) to avoid running out of disk space.

### Instructions

This script was designed to be executed on the Tractor engine, and with the default cmd-logs spool path settings: `/var/spool/tractor/cmd-logs` and with `DBArchiving` set to `False` in tractor.config.

The script will find all jobs which have *do not* have status `active` and which are older than `n` days. It will then delete all associated task logs and the job itself from the Tractor database.

#### Installation and execution of script

Edit the script and set the path to tq, the engine name/IP, the cmd-logs location, the purge log, and the number of days worth of jobs and logs to keep.

Then execute like this:

    python tractor-purge.py


Or run as cron job every 1 day:

    chmod +x python tractor-purge.py
    echo "0 0 */1 * * root python /path/to/tractor-purge.py" >> /etc/crontab

<commit_msg>Renamed headline<commit_after># tractor-purge

Purge task logs from [Pixar's Tractor](https://renderman.pixar.com/view/pixars-tractor) to avoid running out of disk space.

### How does this work?

This script was designed to be executed on the Tractor engine, and with the default cmd-logs spool path settings: `/var/spool/tractor/cmd-logs` and with `DBArchiving` set to `False` in tractor.config.

The script will find all jobs which have *do not* have status `active` and which are older than `n` days. It will then delete all associated task logs and the job itself from the Tractor database.

#### Installation and execution of script

Edit the script and set the path to tq, the engine name/IP, the cmd-logs location, the purge log, and the number of days worth of jobs and logs to keep.

Then execute like this:

    python tractor-purge.py


Or run as cron job every 1 day:

    chmod +x python tractor-purge.py
    echo "0 0 */1 * * root python /path/to/tractor-purge.py" >> /etc/crontab


{'fraction_non_alphanumeric': 0.08191808191808192, 'fraction_numerical': 0.003996003996003996, 'mean_word_length': 3.803357314148681, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4241084', 'n_tokens_mistral': 620, 'n_tokens_neox': 587, 'n_words': 288}