FlowServerCLI
Introduction¶
First, You can execute the following command to quickly install:
Secondly, We will introduce how to interact with iflearner_flow_server
using the command line toolflow_server_cli
, the following are
the subcommands.
Usage: flow_server_cli [OPTIONS] COMMAND [ARGS]...
Iflearner Flow Server Cli.
Options:
-h, --help Show this message and exit.
Commands:
init Iflearner Server Flow Cli Init Command
task Task Operations Group
template Template Operations Group
The specific command usage is as follows.
Initialization¶
Before using the command line, we need to initialize the operation, mainly to configure the relevant parameters of the connection service
Usage
OPTIONS
parameter name | required | type | description |
---|---|---|---|
--host | yes | string | The host of the connection serveriflearner_flow_server |
--port | yes | string | The port of the connection serveriflearner_flow_server |
Request Example
Request Example
Template¶
create¶
Create a task template
Usage
OPTIONS
parameter name | rRequired | type | description |
---|---|---|---|
-n, --template_name | yes | string | Template name |
-r, --remark | no | string | Template description |
-i, --image_url | yes | string | Image url address of template configuration |
-w, --workdir | no | string | Image workdir |
-c, --command | no | string | Image startup command |
-hp, --hyper_parameter | no | string | Hyperparameter passed by image startup |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.template_id | string | Generated template id |
Request Example
flow_server_cli template create -n template_01 -r 'template test' -i pytorch_ocr:latest -w /data/ocr -c '["python", "run.py"]' -hp '["epoch=1"]'
Response Example
{
"ret_code": 0,
"ret_msg": "success",
"data": {
"template_id": "20f42769b99b492691da1ba2f236b1"
}
}
update¶
Update a specified template
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --template_id | yes | string | The unique id of the template |
-n, --template_name | yes | string | Template name |
-r, --remark | no | string | Template description |
-i, --image_url | yes | string | Image url address of template configuration |
-w, --workdir | no | string | Image workdir |
-c, --command | no | string | Image startup command |
-hp, --hyper_parameter | no | string | Hyperparameters passed by mirror startup |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.template_id | string | Generated template id |
Request Example
flow_server_cli template update -id 20f42769b99b492691da1ba2f236b1 -n template_01 -r 'template test' -i pytorch_ocr:latest -w /data/ocr -c '["python", "run.py"]' -hp '["epoch=1" ]'
Response Example
get¶
Query a task template information
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --template_id | yes | string | The Unique id of the template |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.name | string | Template name |
data.remark | string | Template remark |
data.image_url | string | The url address of the template image |
data.workdir | string | The working directory of the template image |
data.command | array | Image startup command |
data.hyper_parameter | array | Hyperparameters for mirror startup |
data.template_id | string | The unique ID of the template |
data.create_time | string | Creation time |
data.modify_time | string | Update time |
Request Example
Response Example
{
"ret_code": 0,
"ret_msg": "success",
"data": {
"name": "template_003",
"remark": "template test",
"image_url": "pytorch_ocr:latest",
"workdir": "/data/ocr",
"command": [
"python",
"run.py"
],
"hyper_parameter": [
"epoch=1"
],
"template_id": "20f42769b99b492691da1ba2f236b1",
"create_time": "Mon, 25 Jul 2022 15:59:55 -0000",
"modify_time": "Mon, 25 Jul 2022 15:59:55 -0000"
}
}
list¶
Batch query template information
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-p, --page | no | int | Current page, default is 1 |
-l, --limit | no | int | The number of queries on the current page, default is 10 |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.templates[index].name | string | Template name |
data.templates[index].remark | string | Template remarks |
data.templates[index].image_url | string | The URL of template image |
data.templates[index].workdir | string | The working directory of the template image |
data.templates[index].command | array | Image startup command |
data.templates[index].hyper_parameter | array | Hyper parameters for mirror startup |
data.templates[index].template_id | string | The Unique ID of the template |
data.templates[index].create_time | string | Creation time |
data.templates[index].modify_time | string | Update time |
Request Example
Response Example
{
"ret_code": 0,
"ret_msg": "success",
"data": {
"templates": [
{
"name": "f5b75371-5dc0-47c6-9a8d-86cd3e06b56a",
"remark": "",
"image_url": "iflearner_ocr:0.0.1",
"workdir": "/data/ocr/script",
"command": [],
"hyper_parameter": null,
"template_id": "0381e7b3bedb4578a3b5a8d11cd65d",
"create_time": "Wed, 20 Jul 2022 16:39:19 -0000",
"modify_time": "Wed, 20 Jul 2022 16:39:19 -0000"
},
{
"name": "707fc798-774a-44be-9844-019c4a7e6714",
"remark": "",
"image_url": "iflearner_ocr:0.0.1",
"workdir": "/data/ocr/script",
"command": [],
"hyper_parameter": null,
"template_id": "0596cb767f0448f4b4fa4f11f65fa8",
"create_time": "Wed, 20 Jul 2022 17:06:20 -0000",
"modify_time": "Wed, 20 Jul 2022 17:06:20 -0000"
}
],
"template_count": 108
}
}
delete¶
Delete a specified task template
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --template_id | yes | string | The unique id of the template |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
Request Example
Response Example
Task¶
create¶
Create task
Usage
OPTIONS
parameter name | rRequired | type | description |
---|---|---|---|
-n, --task_name | yes | string | the name of task |
-t, --template_id | yes | string | task-related template |
-r, --remark | no | string | task remark |
-fd, --federate_data | yes | array | task-related federate |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.task_id | string | task id |
Request Example
flow_server_cli task create -n task01 -t ea0f10bfbaf64a74a061d54c94cc69 -r "This is a remark." -fd '[{"federated_id": "federate-1", "federated_data": ""}]'
Response Example
update¶
Update task
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --task_id | yes | string | task id |
-n, --task_name | yes | string | the name of task |
-t, --template_id | yes | string | task-related template |
-r, --remark | no | string | task remark |
-fd, --federate_data | yes | array | task-related federate |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
Request Example
flow_server_cli task update -id bbc0c30e96bc4da29b2b326fb1f8786e -n task01 -t ea0f10bfbaf64a74a061d54c94cc69 -r "This is a new remark." -fd '[{"federated_id": "federate-1", "federated_data": ""}]'
Response Example
get¶
Get task
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --task_id | yes | string | task id |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data | dict | task detail |
Request Example
Response Example
{
"data": {
"create_time": "Mon, 25 Jul 2022 20:31:21 -0000",
"federate_data": [
{
"federated_data": "aa",
"federated_id": "federate-1"
}
],
"modify_time": "Mon, 25 Jul 2022 20:31:21 -0000",
"name": "testCase",
"party_status": null,
"remark": "This is a remark.",
"status": null,
"task_id": "0578abed1032425499abd20f2ef67938",
"template_id": "ea0f10bfbaf64a74a061d54c94cc69"
},
"ret_code": 0,
"ret_msg": "success"
}
list¶
Get task list
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-p, --page | no | int | Current page, default is 1 |
-l, --limit | no | int | The number of queries on the current page, default is 10 |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
data.task_count | int | total task number |
data.tasks | array | task list |
Request Example
Response Example
{
"data": {
"task_count": 1,
"tasks": [
{
"create_time": "Tue, 26 Jul 2022 16:05:59 -0000",
"federate_data": [
{
"federated_data": "",
"federated_id": "federate-1"
}
],
"modify_time": "Tue, 26 Jul 2022 16:05:59 -0000",
"name": "testCase1",
"party_status": null,
"remark": "This is a remark.",
"status": null,
"task_id": "b1731d312dae4edba6d07a6fff547b4a",
"template_id": "ea0f10bfbaf64a74a061d54c94cc69"
}
]
},
"ret_code": 0,
"ret_msg": "success"
}
delete¶
Delete task
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --task_id | yes | string | task id |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
Request Example
Response Example
start¶
Start task
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --task_id | yes | string | task id |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
Request Example
Response Example
stop¶
Stop task
Usage
OPTIONS
parameter Name | required | type | description |
---|---|---|---|
-id, --task_id | yes | string | task id |
Response
parameter name | type | description |
---|---|---|
ret_code | int | Return code |
ret_msg | string | Return information |
Request Example
Response Example