Skip to content

Commit

Permalink
add workflow api (#1516)
Browse files Browse the repository at this point in the history
* add workflow api

* update

* update

* update
  • Loading branch information
cooper-lzy authored Jul 19, 2022
1 parent 8d36b96 commit 5657e63
Show file tree
Hide file tree
Showing 10 changed files with 657 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs-2.0/nebula-explorer/12.query-visually.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The Visual Query feature uses a visual representation to express related request

## Page elements

![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-query-beta_2022-04-15_15-40-07_en.png)
![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-query-20220718-en.png)

At the top of the Explorer page, click **Visual Query** to enter the visual query page. On the left side of the **Visual Query** page, all the Tag(s) corresponding to the graph space (e.g.player and team) and the Tag named **Any Tag** are displayed. You can query vertices without tags by the Tag named **Any Tag**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You have connected to Explorer. For details, see [Connect to Explorer](../deploy

After connecting to Explorer, the system automatically displays the graph space selection page. You only need to select the target graph space.

![Create_graphspace](https://docs-cdn.nebula-graph.com.cn/figures/create-graphspace_en.png)
![Create_graphspace](https://docs-cdn.nebula-graph.com.cn/figures/select-space-220718-en.png)

If you want to select a graph space again, follow the below steps to choose one.

Expand Down
62 changes: 62 additions & 0 deletions docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Cancel a running job

This topic describes how to use an API to cancel a running job.

## API path

`api-open/v1/jobs/<job_id>/cancel`

`<job_id>`: The job ID. See request parameters below.

## Request parameters

### Path parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`job_id`|number|yes|-|`1964`|The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.|

### Headers parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.|
|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).|

### Body parameters

None.

### Request example

```bash
curl -i -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/30600/cancel
```

## Response parameters

|Parameters|Type|Example|Description|
|:---|:---|:---|:---|
|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). |
|`message` | string | `Success` | The result information of the execution. |
|`data` | object | - | The list of returned data. |
|&nbsp;&nbsp;&nbsp; - `success` | bool | `true` | Whether the job was canceled successfully.|

### Response example

```http
{
"cookie": [],
"Content-Type": "application/json",
"Traceparent": "00-8b4b47413a211d9b5e0839aadc712052-4a98bae37fe5948a-00",
"Date": "Mon, 18 Jul 2022 01:45:08 GMT",
"Content-Length": "54"
}
{
"code": 0,
"data": {
"success": true
},
"message": "Success"
}
```
88 changes: 88 additions & 0 deletions docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Query details for a specified job

This topic describes how to use an API to query details for a specified job.

## API path

`api-open/v1/jobs/<job_id>`

`<job_id>`: The job ID. See request parameters below.

## Request parameters

### Path parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`job_id`|number|yes|-|`1964`| The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.|

### Headers parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`Content-Type`|string|yes|-|`application/json`|The content type.|
|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).|

### Body parameters

None.

### Request example

```bash
curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/1964
```

## Response parameters

|Parameters|Type|Example|Description|
|:---|:---|:---|:---|
|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). |
|`message` | string | `Success` | The result information of the execution. |
|`data` | object | - | The list of returned data. |
|&nbsp;&nbsp;&nbsp; - `id` | number | `1964` | The job ID.|
|&nbsp;&nbsp;&nbsp; - `name` | string | `workflow_xkkjf_20220712103332` | The job name. |
|&nbsp;&nbsp;&nbsp; - `workflowId` | string | `3992429968` | The workflow ID. |
|&nbsp;&nbsp;&nbsp; - `workflowName` | string | `workflow_xkkjf` | The workflow name. |
|&nbsp;&nbsp;&nbsp; - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). |
|&nbsp;&nbsp;&nbsp; - `tasks` | object | -| The task details. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `id` | string | `f93dea90fc3a11ecac7e6da0662c195b`| The task ID. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `name` | string | `BFS`| The task name. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `runBeginTime` | datetime | `2022-07-12T10:33:35+08:00` | The start time of the task execution. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `runEndTime` | datetime | `2022-07-12T10:33:38+08:00` | The end time of the task execution. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `status` | number | `2` | The task status code. For details, see [Workflow API overview](workflow-api-overview.md). |

### Response example

```http
{
"cookie": [],
"Content-Type": "application/json",
"Traceparent": "00-3db17c9fd9e0a4c3824973471523d214-4384705e523dce83-00",
"Date": "Fri, 15 Jul 2022 09:08:20 GMT",
"Content-Length": "400"
}
{
"code": 0,
"data": {
"id": 1964,
"name": "workflow_xkkjf_20220712103332",
"workflowId": "3992429968",
"workflowName": "workflow_xkkjf",
"status": 2,
"tasks": [
{
"id": "f93dea90fc3a11ecac7e6da0662c195b",
"name": "BFS",
"runBeginTime": "2022-07-12T10:33:35+08:00",
"runEndTime": "2022-07-12T10:33:38+08:00",
"status": 2
}
],
"runBeginTime": 1657593215000,
"runEndTime": 1657593218000,
"createTime": 1657593212505
},
"message": "Success"
}
```
82 changes: 82 additions & 0 deletions docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Get the result data of a specified task

This topic describes how to use an API to get the result data of a specified task.

## API path

`api-open/v1/jobs/<job_id>/tasks/<task_id>/sample_result`

- `<job_id>`: The job ID. See request parameters below.

- `<task_id>`: The task ID. See request parameters below.

## Request parameters

### Path parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`job_id`|number|yes|-|`29987`| The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.|
|`task_id`|number|yes|-|`8c171f70fb6f11ecac7e6da0662c195b`|The task ID. It can be queried through the API [Query details for a specified job](api-desc-job.md) or viewed in the upper right corner of the specified job page by clicking the component.|

### Headers parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.|
|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).|

### Body parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`limit`|number|yes|`10`|-| Limit the number of rows to return results.|

### Request example

```bash
curl -i -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/29987/tasks/8c171f70fb6f11ecac7e6da0662c195b/sample_result?limit=1000
```

## Response parameters

|Parameters|Type|Example|Description|
|:---|:---|:---|:---|
|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). |
|`message` | string | `Success` | The result information of the execution. |
|`data` | object | - | The list of returned data. |
|&nbsp;&nbsp;&nbsp; - `items`|list|-| The list of detailed results.|
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `result` | string | `"player110","0.150000"` | Depending on the algorithm, the result could be 2 or 3 columns.|

### Response example

```http
{
"cookie": [],
"Content-Type": "application/json",
"Traceparent": "00-14047b04b6810be06be22e010f500506-4c310a844b824a7f-00",
"Date": "Fri, 15 Jul 2022 09:36:56 GMT",
"Content-Length": "2014"
}
{
"code": 0,
"data": {
"items": [
[
"player110",
"0.150000"
],
[
"team219",
"0.452126"
],
......
[
"player121",
"0.262148"
]
]
},
"message": "Success"
}
```
107 changes: 107 additions & 0 deletions docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Get a list of all jobs

This topic describes how to use an API to get a list of all jobs.

## API path

`api-open/v1/jobs`

## Request parameters

### Path parameters

None.

### Headers parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`Content-Type`|string|yes|-|`application/json`|The content type.|
|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).|

### Body parameters

|Parameters|Type|If required|Default value|Example| Description|
|:---|:---|:---|:---|:---|:---|
|`filter` | object| no|-|-| The filter settings.|
|&nbsp;&nbsp;&nbsp;- `name` |string |no |-|`workflow_q745a_20220715092236`| The job name. |
|&nbsp;&nbsp;&nbsp;- `status` |number |no |-|`2`| The job status code. For details, see [Workflow API overview](workflow-api-overview.md).|
|&nbsp;&nbsp;&nbsp;- `fromCreateTime` | number| no|-|`1657848036000`| Start time stamp. Filtering based on the job creation time.|
|&nbsp;&nbsp;&nbsp;- `toCreateTime` |number |no |-|`1657848157000`| End time stamp. Filtering based on the job creation time.|
|&nbsp;&nbsp;&nbsp;- `orderByCreateTime` | string| no|`desc`|-| Sorting mode. The available value are `desc` and `asc`. |
|`pageSize` |number |no| `10`| -| The number of entries to return on each page.|
|`page` |number |no| `1`| -| The number of the page to return.|

### Request example

!!! note

The content after `jobs?` is the body parameter, and the content of `filter` is the result of URL encoding. The original content of `filter` was `{ "status": 2, "orderByCreateTime": "asc"}`.

```bash
curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs?filter=%7B%20%22status%22%3A%202%2C%20%20%22orderByCreateTime%22%3A%20%22asc%22%7D&pageSize=10&page=1
```

## Response parameters

|Parameters|Type|Example|Description|
|:---|:---|:---|:---|
|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). |
|`message` | string | `Success` | The result information of the execution. |
|`data` | object | - | The list of returned data. |
|&nbsp;&nbsp;&nbsp;- `total` | number | `2` |The total number of records. |
|&nbsp;&nbsp;&nbsp;- `Page` | number | `1` | The number of the page to return. |
|&nbsp;&nbsp;&nbsp;- `PageSize` | number | `10` | The number of entries to return on each page. |
|&nbsp;&nbsp;&nbsp;- `items` | object | - | The list of record details. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `id` | number | `105` | The job ID. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `name` | string | `workflow_q745a_20220715090915` | The job name. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `workflowId` | string | `4216617528` | The workflow ID. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `workflowName` | string | `workflow_q745a` | The workflow name. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `runBeginTime` | number | `1657847358000` | The start time of the job execution. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `runEndTime` | number | `1657847364000` | The end time of the job execution. |
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - `createTime` | number | `1657847355906` | The creation time of the job. |

### Response example

```http
{
"cookie": [],
"Content-Type": "application/json",
"Traceparent": "00-d3a1943f5baf46771e9afc629e0b5d40-920db2f06142f5ff-00",
"Date": "Fri, 15 Jul 2022 06:17:21 GMT",
"Content-Length": "512"
}
{
"code": 0,
"data": {
"items": [
{
"id": 105,
"name": "workflow_q745a_20220715090915",
"workflowId": "4216617528",
"workflowName": "workflow_q745a",
"status": 2,
"runBeginTime": 1657847358000,
"runEndTime": 1657847364000,
"createTime": 1657847355906
},
{
"id": 106,
"name": "workflow_q745a_20220715092236",
"workflowId": "4216617528",
"workflowName": "workflow_q745a",
"status": 2,
"runBeginTime": 1657848157000,
"runEndTime": 1657848163000,
"createTime": 1657848156290
}
],
"total": 2,
"Page": 1,
"PageSize": 10
},
"message": "Success"
}
```
Loading

0 comments on commit 5657e63

Please sign in to comment.