<commit_before>#!/usr/bin/env python

import logging
import threading
from datetime import datetime
import sys
from time import sleep
import flask
from flask.ext.sqlalchemy import SQLAlchemy

app = flask.Flask(__name__, instance_relative_config=True)
app.config.from_pyfile('settings.py')
db = SQLAlchemy(app)

sys.path.append(app.config['ROOTIO_WEB_PATH'])

def run():
    from rootio.radio.models import Station
    import radio_station

    logging.basicConfig()
    logger = logging.getLogger('station_runner')

    radio_station.telephony_server = app

    stations = db.session.query(Station)
    for station in stations.all():
        radio_station = radio_station.RadioStation(station.id, logger)
        logger.info('launching station : {0}'.format(station.id))
        t = threading.Thread(target=radio_station.run, args=())
        t.start()

    print "radio station telephony service started"

if __name__ == "__main__":
    run()
<commit_msg>RadioStation needs a new parameter, `session`<commit_after>#!/usr/bin/env python

import logging
import threading
from datetime import datetime
import sys
from time import sleep
import flask
from flask.ext.sqlalchemy import SQLAlchemy

app = flask.Flask(__name__, instance_relative_config=True)
app.config.from_pyfile('settings.py')
db = SQLAlchemy(app)

sys.path.append(app.config['ROOTIO_WEB_PATH'])

def run():
    from rootio.radio.models import Station
    import radio_station

    logging.basicConfig()
    logger = logging.getLogger('station_runner')

    radio_station.telephony_server = app

    stations = db.session.query(Station)
    for station in stations.all():
        radio_station = radio_station.RadioStation(station.id, db.session, logger)
        logger.info('launching station : {0}'.format(station.id))
        t = threading.Thread(target=radio_station.run, args=())
        t.start()

    print "radio station telephony service started"

if __name__ == "__main__":
    run()

{'fraction_non_alphanumeric': 0.10480572597137014, 'fraction_numerical': 0.0010224948875255625, 'mean_word_length': 4.260752688172043, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '7256607', 'n_tokens_mistral': 602, 'n_tokens_neox': 581, 'n_words': 142}