Exemple #1
0
 def run_instance(self, instance):
     instance.log = log.Log(os.devnull, echo=True)
     try:
         instance.start()
     except SystemExit:
         pass
     return Instance.objects.get(pk=instance.pk)
Exemple #2
0
#!/usr/bin/env python

import sys, datetime, pickle, time
from optparse import OptionParser

from boto.sqs.connection import SQSConnection
from boto.exception import SQSError

from norc import settings
from norc.norc_utils import formatting
from norc.norc_utils import log
log = log.Log(settings.LOGGING_DEBUG)


def get_name(q):
    name = q.url.split('/')[-1]
    return name


def delete_queue(c, queue_name):
    q = c.get_queue(queue_name)
    if q == None:
        raise Exception("No queue exists by name '%s'" % (queue_name))
    log.info("Deleting q '%s' (had %s messages)" % (queue_name, q.count()))
    q.delete()


def clear_queue(c, queue_name, use_api):
    q = c.get_queue(queue_name)
    if q == None:
        raise Exception("No queue exists by name '%s'" % (queue_name))
Exemple #3
0
 def setUp(self):
     """Create the executor and thread objects."""
     self.queue = DBQueue.objects.create(name='test')
     self._executor = Executor.objects.create(queue=self.queue, concurrent=4)
     self._executor.log = log.Log(os.devnull)
     self.thread = Thread(target=self._executor.start)
Exemple #4
0
 def setUp(self):
     self._scheduler = Scheduler.objects.create()
     self._scheduler.log = log.Log(os.devnull)
     self.thread = Thread(target=self._scheduler.start)
     self.thread.start()
     wait_until(lambda: self.scheduler.is_alive(), 3)