def set_product_task( prdid ): task = { 'prdid' : prdid, 'ctime' : time.time() } task_k = KEY_PRODUCT_TASK.format( p = prdid ) cli = get_cli() cli.set( task_k, json.dumps( task ) )
def get_product_task( prdid ): cli = get_cli() d = cli.get( KEY_PRODUCT_TASK.format( p = prdid ) ) if d is None: return None try: return json.loads( d ) except Exception as e: logger.info( 'get task: {p} {d} {e}'.format( p = prdid, d = repr( d ), e = repr( e ) ) )
def get_product_task(prdid): cli = get_cli() d = cli.get(KEY_PRODUCT_TASK.format(p=prdid)) if d is None: return None try: return json.loads(d) except Exception as e: logger.info('get task: {p} {d} {e}'.format(p=prdid, d=repr(d), e=repr(e)))
def set_product_task(prdid): task = {'prdid': prdid, 'ctime': time.time()} task_k = KEY_PRODUCT_TASK.format(p=prdid) cli = get_cli() cli.set(task_k, json.dumps(task))