示例#1
0
文件: tq.py 项目: xmonader/tq
 def get_job_result_from_redis(self, job):
     try:
         if self.r.exists(job.job_result_key_cached):
             val = dill_loads(self.r.get(job.job_result_key_cached))
         else:
             val = dill_loads(self.r.get(job.job_result_key))
     except Exception as e:
         raise e
示例#2
0
文件: tq.py 项目: abom/tq
def job_get_result(job, redis_connection):
    val = None
    try:
        if job.memoized and redis_connection.exists(job.jobkey_cached):
            val = dill_loads(redis_connection.get(job.jobkey_cached))
        else:
            val = dill_loads(redis_connection.get(job.jobkey))
    except Exception as e:
        print("[-] error getting job result: ", e)
    return val
示例#3
0
文件: tq.py 项目: xmonader/tq
    def get_job_result(self, job, raise_exception=False):
        if raise_exception and job.state == JobState.FAILURE:
            job.safe_to_collect = True
            self.save_job(job)
            raise RuntimeError(job.error)

        job = tm.get_job(job.job_key)
        val = None
        try:
            if job.memoized and self.r.exists(job.job_result_key_cached):
                val = dill_loads(self.r.get(job.job_result_key_cached))
            else:
                val = dill_loads(self.r.get(job.job_result_key))
        except Exception as e:
            print("[-] error getting job result: ", e)
        job.safe_to_collect = True
        self.save_job(job)
        return val
示例#4
0
 def loadObject(obj):
     try:
         return dill_loads(obj)
     except (UnpicklingError, ):
         raise LoadError(dill.__name__)
示例#5
0
文件: tq.py 项目: abom/tq
def job_loads(data):
    return dill_loads(data)
示例#6
0
文件: tq.py 项目: abom/tq
 def getfn(self):
     return dill_loads(self.fun)