示例#1
0
 def worker(self, dl_queue):
     db = JobsDB(readonly=False)
     while not self.done:
         action, job = self.queue.get()
         if action == Actions.PURGE_LOGS:
             db.purge_jobs()
         elif action == Actions.INSERT:
             db.clean_old_jobs(self.app_config['ydl_server']
                               .get('max_log_entries', 100))
             db.insert_job(job)
             dl_queue.put(job)
         elif action == Actions.UPDATE:
             db.update_job(job)
         elif action == Actions.RESUME:
             db.update_job(job)
             dl_queue.put(job)
         elif action == Actions.SET_NAME:
             job_id, name = job
             db.set_job_name(job_id, name)
         elif action == Actions.SET_LOG:
             job_id, log = job
             db.set_job_log(job_id, log)
         elif action == Actions.SET_STATUS:
             job_id, status = job
             db.set_job_status(job_id, status)
         elif action == Actions.CLEAN_LOGS:
             db.clean_old_jobs()
         self.queue.task_done()
示例#2
0
def worker(dl_queue):
    db = JobsDB(readonly=False)
    while not done:
        action, job = queue.get()
        if action == Actions.PURGE_LOGS:
            db.purge_jobs()
        elif action == Actions.INSERT:
            db.insert_job(job)
            dl_queue.put(job)
        elif action == Actions.UPDATE:
            db.update_job(job)
        elif action == Actions.RESUME:
            db.update_job(job)
            dl_queue.put(job)
        queue.task_done()
示例#3
0
def worker(dl_queue):
    db = JobsDB(readonly=False)
    while not done:
        action, job = queue.get()
        if action == Actions.PURGE_LOGS:
            db.purge_jobs()
        elif action == Actions.INSERT:
            db.insert_job(job)
            dl_queue.put(job)
        elif action == Actions.UPDATE:
            db.update_job(job)
        elif action == Actions.RESUME:
            db.update_job(job)
            dl_queue.put(job)
        elif action == Actions.SET_NAME:
            job_id, name = job
            db.set_job_name(job_id, name)
        elif action == Actions.SET_LOG:
            job_id, log = job
            db.set_job_log(job_id, log)
        elif action == Actions.SET_STATUS:
            job_id, status = job
            db.set_job_status(job_id, status)
        queue.task_done()