def __init__(
     self,
     cache_dir,
     mwrender_cmd,
     mwrender_logfile,
     mwzip_cmd,
     mwzip_logfile,
     mwpost_cmd,
     mwpost_logfile,
     queue_dir,
     default_writer='rl',
     report_from_mail=None,
     report_recipients=None,
 ):
     self.cache_dir = utils.ensure_dir(cache_dir)
     self.mwrender_cmd = mwrender_cmd
     self.mwrender_logfile = mwrender_logfile
     self.mwzip_cmd = mwzip_cmd
     self.mwzip_logfile = mwzip_logfile
     self.mwpost_cmd = mwpost_cmd
     self.mwpost_logfile = mwpost_logfile
     if queue_dir:
         self.queue_job = filequeue.FileJobQueuer(
             utils.ensure_dir(queue_dir))
     else:
         self.queue_job = no_job_queue
     self.default_writer = default_writer
     self.report_from_mail = report_from_mail
     self.report_recipients = report_recipients
Exemple #2
0
    def __init__(self, cache_dir,
        mwrender_cmd, mwrender_logfile,
        mwzip_cmd, mwzip_logfile,
        mwpost_cmd, mwpost_logfile,
        queue_dir,
        default_writer='rl',
        report_from_mail=None,
        report_recipients=None,
    ):
        self.cache_dir = utils.ensure_dir(cache_dir)
        self.mwrender_cmd = mwrender_cmd
        self.mwrender_logfile = mwrender_logfile
        self.mwzip_cmd = mwzip_cmd
        self.mwzip_logfile = mwzip_logfile
        self.mwpost_cmd = mwpost_cmd
        self.mwpost_logfile = mwpost_logfile
        self.queue_upload_job = self.queue_render_job = no_job_queue
        if queue_dir:
            self.queue_render_job = filequeue.FileJobQueuer(utils.ensure_dir(queue_dir))
        self.default_writer = default_writer
        self.report_from_mail = report_from_mail
        self.report_recipients = report_recipients

        for i in range(0x100, 0x200):
            p = os.path.join(self.cache_dir, hex(i)[3:])
            if not os.path.isdir(p):
                os.mkdir(p)
 def __init__(self, queue_dir, processing_dir, sleep_time=1, max_num_jobs=5):
     self.queue_dir = utils.ensure_dir(queue_dir)
     self.processing_dir = utils.ensure_dir(processing_dir)
     self.sleep_time = sleep_time
     self.max_num_jobs = max_num_jobs
     self.num_jobs = 0
     self.log = Log('FileJobPoller')
Exemple #4
0
 def __init__(self,
              queue_dir,
              processing_dir=None,
              sleep_time=1,
              max_num_jobs=5):
     self.queue_dir = utils.ensure_dir(queue_dir)
     self.sleep_time = sleep_time
     self.max_num_jobs = max_num_jobs
     self.num_jobs = 0
     self.log = Log('FileJobPoller')
     self.files = []
Exemple #5
0
 def __init__(self, cache_dir,
     mwrender_cmd, mwrender_logfile,
     mwzip_cmd, mwzip_logfile,
     mwpost_cmd, mwpost_logfile,
     queue_dir,
     default_writer='rl',
     report_from_mail=None,
     report_recipients=None,
 ):
     self.cache_dir = utils.ensure_dir(cache_dir)
     self.mwrender_cmd = mwrender_cmd
     self.mwrender_logfile = mwrender_logfile
     self.mwzip_cmd = mwzip_cmd
     self.mwzip_logfile = mwzip_logfile
     self.mwpost_cmd = mwpost_cmd
     self.mwpost_logfile = mwpost_logfile
     if queue_dir:
         self.queue_job = filequeue.FileJobQueuer(utils.ensure_dir(queue_dir))
     else:
         self.queue_job = no_job_queue
     self.default_writer = default_writer
     self.report_from_mail = report_from_mail
     self.report_recipients = report_recipients
Exemple #6
0
def main():
    from gevent import pywsgi as wsgi
    # from gevent import wsgi

    WSGIServer = wsgi.WSGIServer
    WSGIHandler = wsgi.WSGIHandler

    WSGIHandler.log_request = lambda *args, **kwargs: None

    import argv
    opts,  args = argv.parse(sys.argv[1:], "--qserve= --port=")
    qs = []
    port = 8899
    for o,a in opts:
        if o=="--port":
            port = int(a)
        elif o=="--qserve":
            qs.append(a)

    if not qs:
        qs.append("localhost:14311")

    _parse_qs(qs)
            
    cachedir = "cache"
    cachedir = utils.ensure_dir(cachedir)
    for i in range(0x100, 0x200):
        p = os.path.join(cachedir, hex(i)[3:])
        if not os.path.isdir(p):
            os.mkdir(p)

    def app(*args, **kwargs):
        return Application(cachedir)(*args, **kwargs)
    
    address = "0.0.0.0", port
    server = WSGIServer(address, app)

    for x in qs:
        worker.Worker.spawn(wait_idle, x, busy).set_max_rate((5, 0))
    
    try:
        print "listening on %s:%d" % address
        server.serve_forever()
    except KeyboardInterrupt:
        server.stop()
        print "bye."
Exemple #7
0
 def __init__(self, queue_dir):
     self.queue_dir = utils.ensure_dir(queue_dir)
     self.log = Log('FileJobQueuer')
Exemple #8
0
 def __init__(self, queue_dir):
     self.queue_dir = utils.ensure_dir(queue_dir)
     self.log = Log('FileJobQueuer')
Exemple #9
0
 def __init__(self, queue_dir):
     self.queue_dir = utils.ensure_dir(queue_dir)