<commit_before>#!/bin/bash

# In case anything returns non-zero, just fail immediately.
set -e

BUG_TRACKER_LIST="$(mktemp --suffix=.yaml /tmp/bug-trackers.$(date -I).XXXX)"
SCRAPY_RESULT_FILE="$(mktemp --suffix=.jsonlines /tmp/scrapy-results.XXXX)"
SCRAPY_LOG="$(mktemp --suffix=.log /tmp/scrapy.XXXX)"
MAX_TRACKERS="500"
if [ ! -z "$1" ] ; then
    MAX_TRACKERS="$1"
fi

if [ ! -z "2" ] ; then
    TRACKER_ID="$2"
fi

wget https://openhatch.org/+api/v1/customs/tracker_model/\?just_stale\=yes\&format\=yaml\&limit\="$MAX_TRACKERS"\&tracker_id="$TRACKER_ID" -O "$BUG_TRACKER_LIST"

pushd ../oh-bugimporters
bin/python bugimporters/main.py -i "$BUG_TRACKER_LIST" -o "$SCRAPY_RESULT_FILE"
popd

python manage.py import_bugimporter_data "$SCRAPY_RESULT_FILE"
<commit_msg>But use the right path to the virtualenv...<commit_after>#!/bin/bash

# In case anything returns non-zero, just fail immediately.
set -e

BUG_TRACKER_LIST="$(mktemp --suffix=.yaml /tmp/bug-trackers.$(date -I).XXXX)"
SCRAPY_RESULT_FILE="$(mktemp --suffix=.jsonlines /tmp/scrapy-results.XXXX)"
SCRAPY_LOG="$(mktemp --suffix=.log /tmp/scrapy.XXXX)"
MAX_TRACKERS="500"
if [ ! -z "$1" ] ; then
    MAX_TRACKERS="$1"
fi

if [ ! -z "2" ] ; then
    TRACKER_ID="$2"
fi

wget https://openhatch.org/+api/v1/customs/tracker_model/\?just_stale\=yes\&format\=yaml\&limit\="$MAX_TRACKERS"\&tracker_id="$TRACKER_ID" -O "$BUG_TRACKER_LIST"

pushd ../oh-bugimporters
env/bin/python bugimporters/main.py -i "$BUG_TRACKER_LIST" -o "$SCRAPY_RESULT_FILE"
popd

python manage.py import_bugimporter_data "$SCRAPY_RESULT_FILE"

{'fraction_non_alphanumeric': 0.178117048346056, 'fraction_numerical': 0.010178117048346057, 'mean_word_length': 4.825925925925926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1405332', 'n_tokens_mistral': 684, 'n_tokens_neox': 639, 'n_words': 109}