From 52c9eb9370daca71aa985e943ebdeed54fe767d0 Mon Sep 17 00:00:00 2001 From: Indy Prentice Date: Fri, 30 Jun 2023 07:23:58 -0500 Subject: [PATCH] fix(restli): Add docs for get task status, and fix hostname regex (#8341) Co-authored-by: Indy Prentice --- docs-website/sidebars.js | 5 ++ docs/api/restli/get-elastic-task-status.md | 50 +++++++++++++++++++ .../operations/OperationsResource.java | 2 +- .../operations/OperationsResourceTest.java | 3 ++ 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 docs/api/restli/get-elastic-task-status.md diff --git a/docs-website/sidebars.js b/docs-website/sidebars.js index 669c569f78..85fa61b88a 100644 --- a/docs-website/sidebars.js +++ b/docs-website/sidebars.js @@ -298,6 +298,11 @@ module.exports = { label: "Truncate Timeseries Aspect", id: "docs/api/restli/truncate-time-series-aspect", }, + { + type: "doc", + label: "Get ElasticSearch Task Status Endpoint", + id: "docs/api/restli/get-elastic-task-status", + }, { type: "doc", label: "Evaluate Tests", diff --git a/docs/api/restli/get-elastic-task-status.md b/docs/api/restli/get-elastic-task-status.md new file mode 100644 index 0000000000..a0d3290f2c --- /dev/null +++ b/docs/api/restli/get-elastic-task-status.md @@ -0,0 +1,50 @@ +# Get ElasticSearch Task Status Endpoint + +You can do a HTTP POST request to `/gms/operations?action=getEsTaskStatus` endpoint to see the status of the input task running in ElasticSearch. For example, the task ID given by the [`truncateTimeseriesAspect` endpoint](./truncate-time-series-aspect.md). The task ID can be passed in as a string with node name and task ID separated by a colon (as is output by the previous API), or the node name and task ID parameters separately. + +``` +curl --location --request POST 'https://demo.datahubproject.io/api/gms/operations?action=getEsTaskStatus' \ +--header 'Authorization: Bearer TOKEN' +--header 'Content-Type: application/json' \ +--data-raw '{ + "task": "aB1cdEf2GHIJKLMnoPQr3S:123456" +}' + +curl --location --request POST http://localhost:8080/operations\?action\=getEsTaskStatus \ +--header 'Authorization: Bearer TOKEN' +--header 'Content-Type: application/json' \ +--data-raw '{ + "nodeId": "aB1cdEf2GHIJKLMnoPQr3S", + taskId: 12345 +}' +``` + +The output will be a string representing a JSON object with the task status. +``` +{ + "value": "{\"error\":\"Could not get task status for XIAMx5WySACgg9XxBgaKmw:12587\"}" +} +``` +``` +"{ + "completed": true, + "taskId": "qhxGdzytQS-pQek8CwBCZg:54654", + "runTimeNanos": 1179458, + "status": "{ + "total": 0, + "updated": 0, + "created": 0, + "deleted": 0, + "batches": 0, + "version_conflicts": 0, + "noops": 0, + "retries": { + "bulk": 0, + "search": 0 + }, + "throttled_millis": 0, + "requests_per_second": -1.0, + "throttled_until_millis": 0 + } +} +``` diff --git a/metadata-service/restli-servlet-impl/src/main/java/com/linkedin/metadata/resources/operations/OperationsResource.java b/metadata-service/restli-servlet-impl/src/main/java/com/linkedin/metadata/resources/operations/OperationsResource.java index 066f257f77..b98fd5c3cd 100644 --- a/metadata-service/restli-servlet-impl/src/main/java/com/linkedin/metadata/resources/operations/OperationsResource.java +++ b/metadata-service/restli-servlet-impl/src/main/java/com/linkedin/metadata/resources/operations/OperationsResource.java @@ -99,7 +99,7 @@ public class OperationsResource extends CollectionResourceTaskTemplate