Ejemplo n.º 1
0
def save_quota(key, value):
    #print 'key, value:', key.encode('utf-8'), value
    try:
        gexf2es(key,value)
    except Exception, e:
        print '******'
        print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())),'SSDB ERROR'
Ejemplo n.º 2
0
def save_attribute_dict(attribute_dict, graph_type):
    '''
    临时保存attribute_dict,所以不进行topic的唯一指定,使其每一次存储都会覆盖上一次的。
    '''
    #ssdb = SSDB(SSDB_HOST, SSDB_PORT)
    
    if graph_type == 'g':
        key = 'g_attribute_dict'
    elif graph_type == 'ds_g':
        key = 'ds_g_attribute_dict'
    print 'key:', key.encode('utf-8')
    value = json.dumps(attribute_dict)
    print type(value)
    get_graph_mappings(key)
    #print '!!!!!!!!!!!!', value
    gexf2es(key, value)

    #result = ssdb.request('set', [key, value])
   
    print time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())), key.encode('utf-8'), 'save success'