Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goblin does not work with aiohttp>=3.0.0 #103

Open
xzy3 opened this issue Mar 22, 2018 · 5 comments
Open

goblin does not work with aiohttp>=3.0.0 #103

xzy3 opened this issue Mar 22, 2018 · 5 comments

Comments

@xzy3
Copy link

xzy3 commented Mar 22, 2018

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 to aiohttp==2.3.7 fixes the problem.

gremlinpython 3.2.6
goblin 2.1.0
aiogremlin 3.2.6
janusgraph 0.2.0
aiohttp 3.1.0

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))
@xzy3
Copy link
Author

xzy3 commented Mar 22, 2018

Well I found an aiogremlin/aiohttp incompatability that partially causes this. I'll be rolling it into the PR I've submitted over there. Now I am getting:

Traceback (most recent call last):
  File "test.py", line 35, in <module>
    leif = loop.run_until_complete(create(goblin_app, leif))
  File "/apps/x86_64/python/3.6.1/lib/python3.6/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "test.py", line 23, in create
    print('getting session')
  File "/scicomp/home/xzy3/.local/virtualenvs/stantz3/lib/python3.6/site-packages/goblin/session.py", line 242, in flush
    await self.save(elem)
  File "/scicomp/home/xzy3/.local/virtualenvs/stantz3/lib/python3.6/site-packages/goblin/session.py", line 294, in save
    result = await self.save_edge(elem)
  File "/scicomp/home/xzy3/.local/virtualenvs/stantz3/lib/python3.6/site-packages/goblin/session.py", line 332, in save_edge
    self.current[hashable_id] = result
TypeError: unhashable type: 'dict'

@xzy3
Copy link
Author

xzy3 commented Mar 27, 2018

Turns out it was the aiogremlin problem and then the need for the special get_hashable_id for JanusGraph. It took me a while to find the goblin-janus-examples repo. It would be helpful to be directed to it more prominently in the documentation.

@davebshow
Copy link
Owner

Yeah I kind of randomly made that repo for a guy a was working for, never really thought about it as docs. Maybe there should be a section in the official docs called "Using Goblin with JanusGraph", though unfortunately I don't have time to do it right now...

@xzy3
Copy link
Author

xzy3 commented Mar 29, 2018

@davebshow something like pull request #104 ? I basically regurgitated some of your comments from recent bugs and things I found in the janus-examples repo. If you point me at other information I can add it/reword/edit.

@davebshow
Copy link
Owner

Thanks @xzy3. I'll review your PR this week when I get a minute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants