【问题标题】:gremlin-python - How can I avoid "Unclosed Client Session" when exiting my program?gremlin-python - 现有程序时如何避免“未关闭的客户端会话”?
【发布时间】:2021-12-03 08:27:52
【问题描述】:

问题

我已经按照gremlin-python 说明中提供的简单示例运行了:

from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))

但后来我的main 关闭,我收到以下错误消息:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000134D79FB070>

如何避免收到此消息?

【问题讨论】:

    标签: python gremlin


    【解决方案1】:

    解决方案

    close 方法在DriverRemoteConnection() 返回的对象中。获得 反对DriverRemoteConnection() 然后执行close 操作 准备关闭它。

    from gremlin_python.process.anonymous_traversal import traversal
    from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
    
    connection = DriverRemoteConnection('ws://localhost:8182/gremlin','g')
    g = traversal().withRemote(connection)
    connection.close()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-17
      相关资源
      最近更新 更多