Esempio n. 1
0
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 ) )
Esempio n. 2
0
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 ) ) )
Esempio n. 3
0
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)))
Esempio n. 4
0
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))