View a markdown version of this page

Gremlin 查询状态 API - Amazon Neptune

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Gremlin 查询状态 API

您可以列出所有活跃的 Gremlin 查询或获取特定查询的状态。这两个操作的底层 HTTP 端点都是https://your-neptune-endpoint:port/gremlin/status

列出活跃的 Gremlin 查询

要列出所有活跃的 Gremlin 查询,请调用不queryId带参数的端点。

请求参数

  • in cludeWaiting(可选)— 如果设置为TRUE,则除了正在运行的查询之外,响应还包括等待的查询。

响应语法

{ "acceptedQueryCount": integer, "runningQueryCount": integer, "queries": [ { "queryId": "guid", "queryEvalStats": { "waited": integer, "elapsed": integer, "cancelled": boolean }, "queryString": "string" } ] }
  • ac cepted QueryCount — 已接受但尚未完成的查询数量,包括队列中的查询。

  • 正在运行 QueryCount — 当前正在运行的 Gremlin 查询的数量。

  • queries – 当前 Gremlin 查询的列表。

示例

AWS CLI
aws neptunedata list-gremlin-queries \ --endpoint-url https://your-neptune-endpoint:port

有关更多信息,请参阅《命令参考》中的 list-gremlin- queries。 AWS CLI

SDK
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) response = client.list_gremlin_queries() print(response)

有关其他语言(如 Java、.NET 等)的 AWS SDK 示例,请参阅AWS SDK

awscurl
awscurl https://your-neptune-endpoint:port/gremlin/status \ --region us-east-1 \ --service neptune-db
注意

此示例假设您的 AWS 证书是在您的环境中配置的。us-east-1替换为 Neptune 集群的区域。

有关awscurl与 IAM 身份验证配合使用的更多信息,请参阅使用带有临时证书的 awscurl 安全地连接到启用 IAM 身份验证的数据库集群

curl
curl https://your-neptune-endpoint:port/gremlin/status

以下输出显示了一个正在运行的查询。

{ "acceptedQueryCount": 9, "runningQueryCount": 1, "queries": [ { "queryId": "fb34cd3e-f37c-4d12-9cf2-03bb741bf54f", "queryEvalStats": { "waited": 0, "elapsed": 23, "cancelled": false }, "queryString": "g.V().out().count()" } ] }

获取特定 Gremlin 查询的状态

要获取特定 Gremlin 查询的状态,请提供参数。queryId

请求参数

响应语法

{ "queryId": "guid", "queryString": "string", "queryEvalStats": { "waited": integer, "elapsed": integer, "cancelled": boolean, "subqueries": document } }
  • qu eryID-查询的 ID。

  • queryString – 提交的查询。在超过 1024 个字符时,将截断为此长度。

  • query EvalStats-查询的统计信息,包括waited(以毫秒为单位的等待时间)、elapsed(以毫秒为单位的运行时间)、cancelled(查询是否已取消)和subqueries(子查询的数量)。

示例

AWS CLI
aws neptunedata get-gremlin-query-status \ --endpoint-url https://your-neptune-endpoint:port \ --query-id "fb34cd3e-f37c-4d12-9cf2-03bb741bf54f"

有关更多信息,请参阅《命令参考》中的 get-gremlin-query-status。 AWS CLI

SDK
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) response = client.get_gremlin_query_status( queryId='fb34cd3e-f37c-4d12-9cf2-03bb741bf54f' ) print(response)

有关其他语言(如 Java、.NET 等)的 AWS SDK 示例,请参阅AWS SDK

awscurl
awscurl https://your-neptune-endpoint:port/gremlin/status/fb34cd3e-f37c-4d12-9cf2-03bb741bf54f \ --region us-east-1 \ --service neptune-db
注意

此示例假设您的 AWS 证书是在您的环境中配置的。us-east-1替换为 Neptune 集群的区域。

有关awscurl与 IAM 身份验证配合使用的更多信息,请参阅使用带有临时证书的 awscurl 安全地连接到启用 IAM 身份验证的数据库集群

curl
curl https://your-neptune-endpoint:port/gremlin/status/fb34cd3e-f37c-4d12-9cf2-03bb741bf54f

以下为响应示例。

{ "queryId": "fb34cd3e-f37c-4d12-9cf2-03bb741bf54f", "queryString": "g.V().out().count()", "queryEvalStats": { "waited": 0, "elapsed": 23, "cancelled": false } }