Giter VIP home page Giter VIP logo

aiogremlin's People

Contributors

davebshow avatar jirikuncar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aiogremlin's Issues

Client connection timeout is not working

Try without any running Gremlin server the following commands:

loop = asyncio.get_event_loop()
ws = GremlinClient(url="ws://localhost:8182", loop=loop, timeout=100000)
loop.run_until_complete(ws.execute("1"))

It immediately raises an error. Moreover, it is not clear what unit timeout is in (I guess seconds, but I haven't seen any time units mentioned).

aiohttp.errors.ClientOSError: [Errno 111] Can not connect to localhost:8182 [Connect call failed ('127.0.0.1', 8182)]

When I try using a server that has run before and stopped running at some point, I get the same behavior.

How to use transactions with the Client

Hi I am using the latest stable version of aiogremlin to communicate with my janusgraph/cassandra implementation. I plan to create multiple vertices and edges in a write query and want to use transactions for such queries. How is the the use of transaction possible using aiogremlin client ?

Connect to Azure CosmosDB graph flavour

Azure provides a graph "flavoured" version of their CosmosDB. There is a little quickstart here.
They expose a gremlin endpoint, i.e. the websocket connection, some info here.

The problem I'm finding with aiogremlin is that I need to provide a certfile and keyfile in aiogremlin/driver/server.py. Can I adapt the code be to connect to that service?

Meaningful errors?

Hi,

when I run queries and have problem in my query I always get this error 1:

GremlinServerError: Code [597]: SCRIPT_EVALUATION. The script submitted for processing evaluated in the {@code ScriptEngine} with errors and could not be  processed.Check the script submitted for syntax errors or other problems and then resubmit..

or error 2:

Code [500]: SERVER_ERROR. A general server error occurred that prevented the request from being processed.

Broken query examples:
error 1 example:

g.V().map()

error 2 example:

g.addV("x")

but on titan logs I can see that for error 1:

MethodSelectionException: Could not find which method map() to invoke from this list:

and error 2:

IllegalArgumentException: The provided key/value array length must be a multiple of two

Do you think there is a way to get this messages and put in exceptions? Would be lot easier to debug it. Especially when there is few database clients or there is many requests and reading titan logs becomes hard.

Remote connections to Gremlin Server using "unknown" serializer

Hi Dave,

I've been integrating aiogremlin with the new Janusgraph 0.2 release and it works happily with TinkerPop 3.2.4.

On my development server I have been reading and writing over WebSockets with no problem at all. The libray works beautifully. However, when I attempt to read / write to the Gremlin Server from another machine I am hitting a problem and am not quite sure what to do about it.

Here's some sample code:

cluster = Cluster(loop=loop, hosts=[HOST_URL])
yield from cluster.open(loop=loop)
client = yield from cluster.connect()
result_set = yield from client.submit(message=query, bindings=bindings)
result = yield from result_set.all()
client.close()

The client establishes a connection fine, but the coro hangs at the yield from result_set.all() statement.

Checking the Gremlin Server logs I see the following:

70327197 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.server.handler.WsGremlinBinaryRequestDecoder  - Gremlin Server is not configured with a serializer for the requested mime type [application/vnd.gremlin-v3.0+json] - u
sing org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 by default
70327198 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0  - Request [PooledUnsafeDirectByteBuf(ridx: 291, widx: 291, cap: 325)] could not be deserialized by org.apache.tinker
pop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0.
70327198 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.server.handler.OpSelectorHandler  - Invalid OpProcessor requested [null]

It seems to me that aiogremlin is not using the expected serializer. [http://aiogremlin.readthedocs.io/en/latest/usage.html](The aiogremlin docs) state that there is a kwarg called message_serializer for the Cluster object's __init__ method, described as:

String denoting the class used for message serialization, currently only supports basic GraphSONMessageSerializer

From my Googling this serializer is org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, a.k.a. application/vnd.gremlin-v1.0+json, whereas aiogremlin appears to be serializing using org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, a.k.a. application/vnd.gremlin-v3.0+json.

I tried changing my gremlin-server.yaml file to add the line:
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV3d0] }} but this just results in the log message:

Could not find configured serializer class - org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 - it will not be available

So I'm a little stumped. Do you know what's going on?

Serialization problem

My setup is: titan-0.9.0-M2-hadoop1 (berkleyDB backend, no index).
When I connect to gremlin server using gremlin shell I can do stuff:

gremlin> root@a33e29cbee9a:/opt/titan# ./bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
19:04:52 INFO  org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph  - HADOOP_GREMLIN_LIBS is set to: /opt/titan-0.9.0-M2-hadoop1/bin/../lib
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.tinkergraph
plugin activated: aurelius.titan
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> g
==>standardtitangraph[berkeleyje:/data/]
gremlin> :> g.addVertex("name","stephen")
==>v[4344]

But with aiogremlin with the code

    resp = yield from client.submit('''
g
    ''')

I receive the error:

  File "/usr/lib/python3.4/asyncio/tasks.py", line 287, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 276, in result
    raise self._exception
  File "/home/spinus/lib/python3.4/site-packages/aiohttp/parsers.py", line 131, in feed_data
    self._parser.send(data)
  File "/home/spinus/lib/python3.4/site-packages/aiogremlin/subprotocol.py", line 41, in gremlin_response_parser
    raise GremlinServerError(message.status_code, message.message)
aiogremlin.exceptions.GremlinServerError: Code [599]: SERIALIZATION. The server was not capable of serializing an object that was returned from the script supplied on the requst. Either transform the object into something Gremlin Server can process within the script or install mapper serialization classes to Gremlin Server..{}
2015-08-07 20:08:55,260 - asyncio - ERROR - Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f708111f908>
2015-08-07 20:08:55,260 - asyncio - ERROR - Unclosed response
client_response: <ClientResponse(ws://localhost:8182/) [101 Switching Protocols]>
<_CIMultiDictProxy {'UPGRADE': 'websocket', 'CONNECTION': 'Upgrade', 'SEC-WEBSOCKET-ACCEPT': 'R8h30JRgaMI63ckjhMU2WpvmYC4='}>

On gremlin server errors look like:

9309867 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.server.handler.WsGremlinBinaryRequestDecoder  - Gremlin Server is not configured with a serializer for the requested mime type [application/json] - using org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0 by default
9309869 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0  - Response [ResponseMessage{requestId=e83b8d8a-4d34-431a-9478-b0327552c407, status=ResponseStatus{code=SUCCESS, message='', attributes={}}, result=ResponseResult{data=[standardtitangraph[berkeleyje:/data/]], meta={}}}] could not be serialized by org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0.
9309869 [gremlin-server-worker-1] WARN  org.apache.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder  - The result [ResponseResult{data=[standardtitangraph[berkeleyje:/data/]], meta={}}] in the request e83b8d8a-4d34-431a-9478-b0327552c407 could not be serialized and returned.
org.apache.tinkerpop.gremlin.driver.ser.SerializationException: com.fasterxml.jackson.databind.JsonMappingException: Cannot get namespace of root (through reference chain: java.util.ArrayList[0]->com.thinkaurelius.titan.graphdb.database.StandardTitanGraph["backend"]->com.thinkaurelius.titan.diskstorage.Backend["storeManager"]->com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter["features"]->com.thinkaurelius.titan.diskstorage.keycolumnvalue.StandardStoreFeatures["keyConsistentTxConfig"]->com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration["rootNamespace"]->com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace["namespace"])
    at org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0.serializeResponseAsBinary(AbstractGraphSONMessageSerializerV1d0.java:116)
    at org.apache.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:65)
    at org.apache.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:45)
    at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633)
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:691)
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:626)
    at org.apache.tinkerpop.gremlin.server.handler.IteratorHandler.write(IteratorHandler.java:119)
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633)
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32)
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908)
    at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:960)
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Cannot get namespace of root (through reference chain: java.util.ArrayList[0]->com.thinkaurelius.titan.graphdb.database.StandardTitanGraph["backend"]->com.thinkaurelius.titan.diskstorage.Backend["storeManager"]->com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter["features"]->com.thinkaurelius.titan.diskstorage.keycolumnvalue.StandardStoreFeatures["keyConsistentTxConfig"]->com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration["rootNamespace"]->com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace["namespace"])
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:232)
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:197)
    at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:186)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:640)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152)
    at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:100)
    at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:21)
    at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:183)
    at org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONUtil.writeWithType(GraphSONUtil.java:49)
    at org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0$ResponseMessageSerializer.ser(AbstractGraphSONMessageSerializerV1d0.java:235)
    at org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0$ResponseMessageSerializer.serialize(AbstractGraphSONMessageSerializerV1d0.java:205)
    at org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0$ResponseMessageSerializer.serialize(AbstractGraphSONMessageSerializerV1d0.java:197)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:114)
    at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2811)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes(ObjectMapper.java:2292)
    at org.apache.tinkerpop.gremlin.driver.ser.AbstractGraphSONMessageSerializerV1d0.serializeResponseAsBinary(AbstractGraphSONMessageSerializerV1d0.java:107)
    ... 16 more
Caused by: java.lang.IllegalArgumentException: Cannot get namespace of root
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:93)
    at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.getNamespace(ConfigElement.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.get(BeanPropertyWriter.java:726)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:506)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:632)
    ... 43 more

I'm not sure this is misconfiguration of server or gremlin serialization bug, have any idea?

Moreover, those lines:

2015-08-07 20:08:55,260 - asyncio - ERROR - Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f708111f908>
2015-08-07 20:08:55,260 - asyncio - ERROR - Unclosed response
client_response: <ClientResponse(ws://localhost:8182/) [101 Switching Protocols]>
<_CIMultiDictProxy {'UPGRADE': 'websocket', 'CONNECTION': 'Upgrade', 'SEC-WEBSOCKET-ACCEPT': 'R8h30JRgaMI63ckjhMU2WpvmYC4='}>

appear on every request, even when gremlin script is evaluated correctly and there is no serialization problems (for example when script is 2+2).

coroutine never awaited

aiogremlin/driver/aiohttp/transport.py:22: RuntimeWarning: coroutine 'ClientWebSocketResponse.send_bytes' was never awaited
  self._ws.send_bytes(message)

I'm getting this warning while using goblin. It also seems that my db is not receiving the request. I added a return to that line and both problems went away.

aiogremlin 3.2.6
goblin 2.1.0

AttributeError: AsyncGraphTraversal.last_traverser

I'm sure I'm missing a step somewhere, but I can't immediately establish what I'm doing wrong from the docs. Here is my sample code to reproduce the problem, followed by the traceback and the output from pip freeze. Any tips gratefully received!

    import asyncio

    from goblin import Goblin


    class City(goblin.Vertex):
        value = goblin.Property(goblin.String)


    loop = asyncio.get_event_loop()
    app = loop.run_until_complete(
        Goblin.open(loop, hosts=['neptune.opendna.internal'])
    )
    app.register(City)
    session = loop.run_until_complete(app.session())  # type: Session

    async def save_location(obj):
        session.add(obj)
        return await session.flush()

    city = City()
    city.value = 'Cape Town'
    loop.run_until_complete(save_location(city))
Traceback (most recent call last):
  File "/Users/george/sites/odna-neptune/vesta/vertices/location.py", line 54, in <module>
    loop.run_until_complete(save_location(city))
  File "/Users/george/.pyenv/versions/3.6.0/lib/python3.6/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "/Users/george/sites/odna-neptune/vesta/vertices/location.py", line 50, in save_location
    return await session.flush()
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 242, in flush
    await self.save(elem)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 292, in save
    result = await self.save_vertex(elem)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 311, in save_vertex
    self._update_vertex)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 412, in _save_element
    result = await create_func(elem)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 419, in _add_vertex
    return await self._add_properties(traversal, props, vertex)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 473, in _add_properties
    return await self._simple_traversal(traversal, elem)
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/goblin/session.py", line 388, in _simple_traversal
    elem = await traversal.next()
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/aiogremlin/process/graph_traversal.py", line 56, in next
    return await self.__anext__()
  File "/Users/george/sites/odna-neptune/venv/lib/python3.6/site-packages/aiogremlin/process/graph_traversal.py", line 18, in __anext__
    object = self.last_traverser.object
AttributeError: 'str' object has no attribute 'object'
aenum==1.4.5
aiogremlin==3.2.5
aiohttp==1.3.3
async-timeout==2.0.0
chardet==3.0.4
Cython==0.27.3
goblin==2.1.0
gremlinpython==3.3.1
idna==2.6
inflection==0.3.1
multidict==3.3.2
PyYAML==3.12
six==1.10.0
tornado==4.5.2
ujson==1.35
uvloop==0.9.1
yarl==0.9.8

Misleading version

In docs one can read: pip install gremlinpython==3.2.6 --no-deps but the currenct version of aiogremlin is 3.2.6rc1.
In the goblin project, TravisCI informs that there is a problem with a build which is strictly connected with aiogremlin version.

How to set up titan for tests?

Hi,

I've set up titan (with cassandra and ES). I can connect to titan and execute simple stuff like "3+5".

When I run ./setup.py test I get:

test_resp_session (tests.tests.GremlinClientSessionTest) ... /usr/lib/python3.4/asyncio/tasks.py:508: DeprecationWarning: asyncio.async() function is deprecated, use ensure_future()
  DeprecationWarning)
ok
test_session (tests.tests.GremlinClientSessionTest) ... ERROR
test_session_manual_reset (tests.tests.GremlinClientSessionTest) ... ERROR
test_session_reset (tests.tests.GremlinClientSessionTest) ... ERROR
test_session_set (tests.tests.GremlinClientSessionTest) ... ERROR
test_connection (tests.tests.GremlinClientTest) ... ok
test_execute (tests.tests.GremlinClientTest) ... ok
test_execute_error (tests.tests.GremlinClientTest) ... ok
test_rebinding (tests.tests.GremlinClientTest) ... ERROR
test_resp_stream (tests.tests.GremlinClientTest) ... ok
test_sub_waitfor (tests.tests.GremlinClientTest) ... ok
test_rebinding (tests.tests.SubmitTest) ... ERROR
test_submit (tests.tests.SubmitTest) ... ok

The errors are like:

aiogremlin.exceptions.GremlinServerError: Code [597]: SCRIPT_EVALUATION. The script submitted for processing evaluated in the {@code ScriptEngine} with errors and could not be  processed.Check the script submitted for syntax errors or other problems and then resubmit..{}

I use titan 0.9.0-M2-hadoop1.
Do I need to do any set up? Or create some objects before the test?

support latest aiohttp version (2.2.5)

Hi,

Thank you for your nice module!
Current aiogremlin supports aiohttp==1.3.3. Is there any plan to support latest aiohttp version ?

I want to use new features of aiohttp.

Bug: redundant GremlinServers will be opened when use cluster

Hello! I found a bug in driver/cluster.py, which happend when using coroutines to send requests to gremlin-server. The impact is that redundant GremlinServers and its hosts will be established.

    async def get_connection(self, hostname=None):
        """
        **coroutine** Get connection from next available host in a round robin
        fashion.

        :returns: :py:class:`Connection<aiogremlin.driver.connection.Connection>`
        """
        if not self._hosts:
            await self.establish_hosts()
        if hostname:
            try:
                host = self._hostmap[hostname]
            except KeyError:
                raise exception.ConfigError(
                    'Unknown host: {}'.format(hostname))
        else:
            host = self._hosts.popleft()
        conn = await host.get_connection()
        self._hosts.append(host) 
        return conn

When self._hosts.popleft(), the variable host could be empty, which lead to other coroutines found that not self._hosts is True and establish a new one. Moving self._hosts.append(host) ahead of conn = await host.get_connection() can fix it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.