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參數的端點。

請求參數

  • includeWaiting (選用)   –   如果設定為 TRUE,則除了執行查詢之外,回應還包括等待查詢。

回應語法

{ "acceptedQueryCount": integer, "runningQueryCount": integer, "queries": [ { "queryId": "guid", "queryEvalStats": { "waited": integer, "elapsed": integer, "cancelled": boolean }, "queryString": "string" } ] }
  • acceptedQueryCount – 已接受但尚未完成的查詢數目,包括佇列中的查詢。

  • runningQueryCount – 目前正在執行的 Gremlin 查詢數量。

  • queries – 目前的 Gremlin 查詢清單。

範例

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

如需詳細資訊,請參閱《 AWS CLI 命令參考》中的 list-gremlin-queries

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 開發套件

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 } }
  • queryId   –   查詢的 ID。

  • queryString – 已提交的查詢。如果超過 1024 個字元即予截斷。

  • queryEvalStats   – 查詢的 統計資料,包括 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"

如需詳細資訊,請參閱《 AWS CLI 命令參考》中的 get-gremlin-query-status

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 開發套件

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 } }