Exemplo n.º 1
0
def doclose():
    transaction.commit()
    resetCaches()
    connection.close()
    db.close()
    storage.close()
Exemplo n.º 2
0
def doclose():
    transaction.commit()
    resetCaches()
    connection.close()
    db.close()
    storage.close()
Exemplo n.º 3
0
friends = cPickle.load(f)
f.close()

print 'adding nodes'
nids = {}
g.debug=0

size = 10000

for a,targets in friends.iteritems():
    name = 'person%s' % a
    node = g.addNode(name=name)
    nids[a]=node['_id']
    if not a % size:
        transaction.commit()
        resetCaches()
        print 'node', a
transaction.commit()

print 'adding relations'
i = 0
edges=[]
incoming={}
outgoing={}
typeid = g.typeid('friend')
for a,targets in friends.iteritems():
    for b in targets:
        i+=1
        aid=nids[a]
        bid=nids[b]
        g.edges[i]=[aid,bid,typeid,{}]
Exemplo n.º 4
0
friends = cPickle.load(f)
f.close()

print 'adding nodes'
nids = {}
g.debug = 0

size = 10000

for a, targets in friends.iteritems():
    name = 'person%s' % a
    node = g.addNode(name=name)
    nids[a] = node['_id']
    if not a % size:
        transaction.commit()
        resetCaches()
        print 'node', a
transaction.commit()

print 'adding relations'
i = 0
edges = []
incoming = {}
outgoing = {}
typeid = g.typeid('friend')
for a, targets in friends.iteritems():
    for b in targets:
        i += 1
        aid = nids[a]
        bid = nids[b]
        g.edges[i] = [aid, bid, typeid, {}]