I am using the gremlin_python library to execute a query on an AWS Neptune database. I have specified a timeout using the evaluationTimeout parameter in the query to handle long-running requests. Despite setting this parameter to MAX_QUERY_TIMEOUT, the query times out before reaching this limit. Here is the specific query causing the issue:
count_companies_with_representatives = (
self.reader_g.V()
.with_("evaluationTimeout", MAX_QUERY_TIMEOUT)
.hasLabel("company")
.where(__.bothE("director").count().is_(P.gt(0)))
.count()
.next()
)
I need each query to respect the set timeout to manage performance and avoid premature terminations.
I tried setting the evaluationTimeout directly in the query as shown above, expecting that this would prevent any timeouts shorter than MAX_QUERY_TIMEOUT. However, the query still times out earlier than anticipated, which suggests that either the timeout setting is not being respected, or I have misunderstood its usage. I was expecting that the timeout would ensure the query could run up to the maximum time allowed before stopping, thus giving it enough time to complete under normal conditions. I’m looking for guidance on how to correctly apply timeouts to individual queries in this setup or understanding if there’s a better approach to managing query execution times.