-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add workflow api #1516
Merged
Merged
add workflow api #1516
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Cancel a running job | ||
|
||
This topic describes how to use 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 used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| | ||
cooper-lzy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### 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 the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | | ||
cooper-lzy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|`message` | string | `Success` | The result information of the execution. | | ||
|`data` | object | - | The list of returned data. | | ||
| - `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
88
docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 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 the 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. | | ||
| - `id` | number | `1964` | The job ID.| | ||
| - `name` | string | `workflow_xkkjf_20220712103332` | The job name. | | ||
| - `workflowId` | string | `3992429968` | The workflow ID. | | ||
| - `workflowName` | string | `workflow_xkkjf` | The workflow name. | | ||
| - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). | | ||
| - `tasks` | object | -| The task details. | | ||
| - `id` | string | `f93dea90fc3a11ecac7e6da0662c195b`| The task ID. | | ||
| - `name` | string | `BFS`| The task name. | | ||
| - `runBeginTime` | datetime | `2022-07-12T10:33:35+08:00` | The start time of the task execution. | | ||
| - `runEndTime` | datetime | `2022-07-12T10:33:38+08:00` | The end time of the task execution. | | ||
| - `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
82
docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 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 the 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. | | ||
| - `items`|list|-| The list of detailed results.| | ||
| - `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
107
docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 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.| | ||
| - `name` |string |no |-|`workflow_q745a_20220715092236`| The job name. | | ||
| - `status` |number |no |-|`2`| The job status code. For details, see [Workflow API overview](workflow-api-overview.md).| | ||
| - `fromCreateTime` | number| no|-|`1657848036000`| Start time stamp. Filtering based on the job creation time.| | ||
| - `toCreateTime` |number |no |-|`1657848157000`| End time stamp. Filtering based on the job creation time.| | ||
| - `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 the 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. | | ||
| - `total` | number | `2` |The total number of records. | | ||
| - `Page` | number | `1` | The number of the page to return. | | ||
| - `PageSize` | number | `10` | The number of entries to return on each page. | | ||
| - `items` | object | - | The list of record details. | | ||
| - `id` | number | `105` | The job ID. | | ||
| - `name` | string | `workflow_q745a_20220715090915` | The job name. | | ||
| - `workflowId` | string | `4216617528` | The workflow ID. | | ||
| - `workflowName` | string | `workflow_q745a` | The workflow name. | | ||
| - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). | | ||
| - `runBeginTime` | number | `1657847358000` | The start time of the job execution. | | ||
| - `runEndTime` | number | `1657847364000` | The end time of the job execution. | | ||
| - `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" | ||
} | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use API ---> use an AP