gremlin-python not working with azure function.

Prasad, Rakesh 221 Reputation points


I am trying to use gremlin python in azure function.

technically it should be possible, but i ran into multiple issues.

1) tornedo used in gremlin python has compatibility issue with python 3.8+, it impacts windows machine, so running on local was nightmare, but it worked fine in axure(where machine is linux)

for local fix was

if sys.platform == 'win32':
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())  # python-3.8.0a4

2) i had to write following line in my init function, without it, i was not able to run my function multiple times

import nest_asyncio

3) now when i am able to run the function, issue is. I am not able to close client.close() function without getting error. "client" is for cosmosDB(gremlin). error is mentioned in the link below.


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,497 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,499 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,606 Reputation points Microsoft Employee

    @Prasad, Rakesh Based on the error, you are likely not running your function without async, causing a thread creation instead of an event loop as mentioned in the official docs.

0 additional answers

Sort by: Most helpful