<commit_before>import pika
from django.conf import settings

URL = settings.JUDGE_AMQP_PATH
params = pika.URLParameters(URL)
vhost = params.virtual_host


def connect():
    return pika.BlockingConnection(params)<commit_msg>Method to initialize all the queues and exchanges for #183<commit_after>import pika
from django.conf import settings

URL = settings.JUDGE_AMQP_PATH
params = pika.URLParameters(URL)
vhost = params.virtual_host
conn = None


def connect():
    global conn, chan
    conn = pika.BlockingConnection(params)
    return conn


def initialize():
    if conn is None:
        raise SystemError('Not connected')
    chan = conn.channel()
    chan.queue_declare(queue='submission', durable=True)
    chan.queue_declare(queue='judge-response', durable=True)
    chan.queue_declare(queue='judge-ping', durable=True)
    chan.exchange_declare(exchange='broadcast', exchange_type='fanout', durable=True)
    chan.exchange_declare(exchange='submission-response', exchange_type='fanout', durable=True)
    chan.exchange_declare(exchange='ping', exchange_type='fanout', durable=True)
    chan.queue_bind(queue='judge-response', exchange='submission-response')
    chan.queue_bind(queue='judge-ping', exchange='ping')
{'fraction_non_alphanumeric': 0.11274509803921569, 'fraction_numerical': 0.0024509803921568627, 'mean_word_length': 5.693989071038251, 'pattern_counts': {'":': 0, '<': 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': '6410480', 'n_tokens_mistral': 393, 'n_tokens_neox': 357, 'n_words': 77}