import asyncio
from goblin import Goblin,Property,String,Integer,Vertex,Edge,VertexProperty
class Person(Vertex):
name = Property(String())
age = Property(Integer())
class Knows(Edge):
pass
loop = asyncio.get_event_loop()
goblin_app = loop.run_until_complete(Goblin.open(loop,
hosts = ['localhost'],
port = '8182',
scheme = 'ws'))
goblin_app.register(Person, Knows)
print("Initialized all the goblin stuff")
async def create(app, data):
print('getting session')
session = await app.session()
print('creating data', data)
session.add(data)
print('flushing')
await session.flush()
print('done')
return data
leif = Person()
leif.name = 'Leif'
leif.age = 28
leif = loop.run_until_complete(create(goblin_app, leif))
jon = Person()
jon.name = 'Jon'
jon.age = 32
jon = loop.run_until_complete(create(goblin_app, jon))
works_with = Knows(leif, jon)
works_with = loop.run_until_complete(create(goblin_app, works_with))
Related to davebshow/aiogremlin#15 something in the newest aiohttp breaks Goblin. In the following script
await session.flush()never returns. There is no error in the database logs and by logging in with the gremlin shell I can see that vertexes are successfully created. I had to apply the change in davebshow/aiogremlin#16 to get that far. Downgrading toaiohttp==2.3.7fixes the problem.gremlinpython 3.2.6
goblin 2.1.0
aiogremlin 3.2.6
janusgraph 0.2.0
aiohttp 3.1.0