You can use the EASCMD client to manage services in Elastic Algorithm Service (EAS) of Platform for AI (PAI). You can run commands to create services, update services, view service details, and manage stress testing tasks. This topic describes the commands that are supported by the EASCMD client and provides sample commands.
Operation commands
The following table describes the features that the EASCMD command-line tool provides for you to manage services.
When you use the EASCMD client to run commands, the specific client name used in the commands may vary. The actual name prevails.
Type | Operation | Description |
Service-related | You can use one of the following methods to use the EASCMD command-line tool:
| |
Resource group-related |
Create a service
Description
You can run the
create
command to create a service. When you create a service, you must provide the HTTP or OSS URL of a resource, which can be a model or processor package. You can upload the resource to Object Storage Service (OSS) and obtain the OSS URL of the uploaded package.Syntax
<eascmd64> create <service_desc_json>
Parameters
service_desc_json: a JSON file that describes the service information, such as the directory in which the input model package is stored and the resource specifications. The following information provides an example of the JSON file:
{ "name": "mnist_saved_model_example", "model_path": "http://eas-data.oss-cn-shanghai.aliyuncs.com/models%2Fmnist_saved_model.tar.gz", "processor": "tensorflow_cpu_1.12", "metadata": { "instance": 1, "cpu": 1 } }
For more information about the service parameters in the JSON file, see Parameters of model services.
Example (In this example, the JSON file that describes the service information is named pmml.json.)
<eascmd64> create pmml.json
The system returns information similar to the following output:
[RequestId]: 1651567F-8F8D-4A2B-933D-F8D3E2DD**** +-------------------+----------------------------------------------------------------------------+ | Intranet Endpoint | http://pai-eas-vpc.cn-shanghai.aliyuncs.com/api/predict/savedmodel_example | | Token | YjQxZDYzZTBiZTZjMzQ5ZmE0MzczZjIxMGZiNzZmMDBkY2VjMDg4**** | +-------------------+----------------------------------------------------------------------------+ [OK] Creating api gateway [OK] Building image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_cn-shanghai:v0.0.1-20190224001315] [OK] Pushing image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_cn-shanghai:v0.0.1-20190224001315] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Service is running
Modify service configurations
Description
You can use the
-D
option in themodify
command to modify the metadata such as the number of instances and CPU quota.Syntax
<eascmd64> modify <service_name> -Dmetadata.<attr_name>=<attr_value>
You can set multiple parameters at a time. For more information, see the following example.
Parameters
<service_name>: the name of the service.
<attr_name>: the name of the parameter.
<attr_value>: the value of the parameter.
Example
Set the number of instances to 10 and the quota for each instance to 5 (including 5 vCPUs and 20 GB of memory).
<eascmd64> modify service_test -Dmetadata.instance=10 -Dmetadata.cpu=5
When you scale resources, you can modify only the value of the metadata.instance parameter of the service. If the specified number of instances is greater than the number of existing instances for the service, the system starts new instances to reach the specified number without affecting existing instances. If the specified number of instances is smaller than the number of existing instances, the system stops specific instances to reach the specified number without affecting other service instances.
NoteDifferent from a full update operation, an update operation that modifies only the number of instances does not trigger a rolling update for the service.
Modify a service
Description
You can run the
modify
command to modify a deployed service.Syntax
<eascmd64> modify <service_name> -s <service_desc_json>
Parameters
<service_name>: the name of the service.
<service_desc_json>: the description file of the service.
NoteWhen you modify a service, you can modify only the parameters that you want to modify in the description file of the service and leave other parameters unchanged. If you modify the model file information and processor information, a new service version is added.
Add a version for a service
Description
You can run the
modify
command to add a version for a deployed service.Syntax
<eascmd64> modify <service_name> -s <service_desc_json>
Parameters
<service_name>: the name of the service.
<service_desc_json>: the description file of the service.
NoteTo add a version for a service, you must specify the model file information and processor information in the description file of the service.
Stop a service
Description
You can run the
stop
command to stop a running service.Syntax
<eascmd64> stop <service_name>
Parameters
<service_name>: the name of the service that you want to stop.
Start a service
Description
You can run the
start
command to restart a stopped service.Syntax
<eascmd64> start <service_name>
Parameters
<service_name>: the name of the service that you want to start.
Delete a service
Description
You can run the
delete
command to delete a service in the current region.Syntax
<eascmd64> delete <service_name>
Parameters
<service_name>: the name of the service that you want to delete.
Example
In this example, the service name is savedmodel_example. To delete the service, perform the following steps:
Run the following command to delete the service:
<eascmd64> delete savedmodel_example
The system returns information similar to the following output:
Are you sure to delete the service [savedmodel_example] in [cn-shanghai]? [Y/n]
Press the Y key. The system returns information similar to the following output:
[RequestId]: 1651567F-8F8D-4A2B-933D-F8D3E2DD**** [OK] Service [savedmodel_example] in region [cn-shanghai] is terminating [OK] Service is terminating [OK] Service is terminating [OK] Service was deleted successfully
Implement a blue-green release
Description
You can run the
create -r
command to create an associated service for an existing service, then run therelease
command to adjust the traffic proportion of the services based on your business requirements. This way, you can implement a blue-green release. The value of the name parameter in the JSON file that describes the information about the new service must be the same as that of the existing service. You can set the other parameters based on your business requirements. The system automatically adds a random suffix to the existing service name to generate a new service name.If you delete the new service, all traffic goes to the existing service. If you delete the existing service, all traffic goes to the new service. The endpoint of the existing service before a blue-green release serves as the traffic entrance for all subsequent blue-green release iterations. No matter how many subsequent blue-green release iterations are conducted, the endpoint, such as {domain}/api/predict/savedmodel_example in the following example, remains unchanged. You do not need to modify the client-side code.
NoteThe blue-green release is not applicable to scenarios where a direct connection is used.
Syntax
Create an associated service.
<eascmd64> create <service_desc_json> -r
Adjust the traffic proportion of the services in a blue-green release.
<eascmd64> release <service_name> -w <weight>
Parameters
<service_desc_json>: the JSON file that describes the information about the new service.
<service_name>: the name of the new service.
<weight>: the proportion of traffic that goes to the new service.
Example (In this example, the JSON file that describes the service information is named pmml.json.)
Create an associated service.
<eascmd64> create pmml.json -r
The system returns information similar to the following output:
[RequestId]: 1651567F-8F8D-4A2B-933D-F8D3E2DD**** +-------------------+----------------------------------------------------------------------------+ | Intranet Endpoint | http://xxx.cn-shanghai.pai-eas.aliyuncs.com/api/predict/savedmodel_example_9c16a222 | | Token | YjQxZDYzZTBiZTZjMzQ5ZmE0MzczZjIxMGZiNzZmMDBkY2VjMDg4**** | +-------------------+----------------------------------------------------------------------------+ [OK] Building image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_9c16a222_cn-shanghai:v0.0.1-20190224001315] [OK] Pushing image [registry-vpc.cn-shanghai.aliyuncs.com/eas/savedmodel_example_9c16a222_cn-shanghai:v0.0.1-20190224001315] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Waiting [Total: 1, Pending: 1, Running: 0] [OK] Service is running
The preceding output indicates that a service named savedmodel_example_9c16a222 is created. The new service and the existing service have independent traffic entrances and can be separately called. You can independently test the new service without affecting the existing online service. After the test is complete, you can adjust the traffic proportion of the services.
Adjust the traffic proportion of the services in a blue-green release.
<eascmd64> release savedmodel_example_9c16a222 -w 20
The preceding command indicates that 20% of the traffic goes to the new service savedmodel_example_9c16a222, and 80% of the traffic goes to the existing service savedmodel_example. In this case, the independent endpoint {domain}/api/predict/savedmodel_example_9c16a222 of the new service is disabled. 20% of the traffic that flows into the endpoint {domain}/api/predict/savedmodel_example of the existing service goes to the new service, and 80% to the existing service.
The system returns information similar to the following output:
Confirmed to release this service at weight [20%]? [Y/n]
Press the Y key and then the Enter key. The system returns information similar to the following output:
[RequestId]: 9258EEDE-6F99-4C3B-841B-B6E9774F**** [OK] Service [savedmodel_example_9c16a222] is weighted to 20% now
Switch between service versions
Description
You can run the
desc
command to view the current version and the latest version of a service. Then, run theversion
command to switch to a version earlier than the latest version.Syntax
<eascmd64> version <service_name> <version_id>
Parameters
<service_name>: the name of the service.
<version_id>: the ID of the version to which you want to switch.
View the service list
Description
You can run the
list
orls
command to view the services that are deployed within the current account.Syntax
<eascmd64> ls
Parameters
N/A
Example
<eascmd64> ls
The system returns information similar to the following output:
[RequestId]: 83945D4E-ED3E-4D35-A989-831E36BB**** +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+ | SERVICENAME | REGION | INSTANCE | CREATETIME | UPDATETIME | STATUS | WEIGHT | SERVICEPATH | +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+ | mnist_saved_model_example | cn-shanghai | 1 | 2019-02-21 16:35:41 | 2019-02-21 16:35:41 | Running | 0 | /api/predict/mnist_saved_model_example | +---------------------------+-------------+----------+---------------------+---------------------+---------+--------+----------------------------------------+
View the details of a service
Description
You can run the
desc
command to view the details of a deployed service.Syntax
<eascmd64> desc <service_name>
Parameters
<service_name>: the name of the service.
Example
<eascmd64> desc mnist_saved_model_example
The system returns information similar to the following output:
+---------------------+--------------------------------------------------------------------------------------------------------------+ | Status | Running | | ServiceName | mnist_saved_model_example | | Region | cn-shanghai | | CreateTime | 2019-02-21 16:35:41 | | UpdateTime | 2019-02-21 16:35:41 | | AccessToken | | | PrivateToken | ZWNjMTNkNDExMmExNjZkYTM4YWQ5YTY0YmFjNjk3YWYzZTRjM2Y2**** | | TotalInstance | 1 | | RunningInstance | 1 | | PendingInstance | 0 | | CPU | 1 | | GPU | 0 | | Memory | 1000M | | Image | registry-vpc.cn-shanghai.aliyuncs.com/eas/mnist_saved_model_example_cn-shanghai:v0.0.1-20190221163541 | | Weight | 0 | | LatestVersion | 1 | | CurrentVersion | 1 | | Message | Service start successfully | | APIGatewayUrl | 1c3b37ea83c047efa0dc6df0cacb****-cn-shanghai.alicloudapi.com/EAPI_182848887922****_mnist_saved_model_example | | APIGatewayAppKey | 2564**** | | APIGatewayAppSecret | 12562a7b8858bbba2c2e9c4517ff**** | | IntranetEndpoint | http://pai-eas-vpc.cn-shanghai.aliyuncs.com/api/predict/mnist_saved_model_example | | ServiceConfig | { | | | "generate_token": "false", | | | "metadata": { | | | "cpu": 1, | | | "instance": 1, | | | | "region": "cn-shanghai" | | | }, | | | "model_path": | | | "http://eas-data.oss-cn-shanghai.aliyuncs.com/models%2Fmnist_saved_model.tar.gz", | | | "name": | | | "mnist_saved_model_example", | | | "processor": | | | "tensorflow_cpu" | | | } | +---------------------+--------------------------------------------------------------------------------------------------------------+
View service process
Description
You can run the
showworkers(w)
orw
command to view the status of the processes that are running in a service.Syntax
<eascmd64> w <service_name>
Parameters
<service_name>: the name of the service.
Example
<eascmd64> w mnist_saved_model_example
The system returns information similar to the following output:
[RequestId]: B23BA8AC-CDEC-5704-935F-3CEC6606**** +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+ | INSTANCENAME | INNERIP | HOSTIP | STARTAT | RESTARTS | STATUS | READY | REASON | LASTSTATE | +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+ | network-test-69cf5dd6c7-5**** | 10.240.XX.XX | 10.224.XX.XX | 2021-09-27 15:04:22 | 1 | Running | [1/1] | | {"exitCode":247,"finishedAt":"2021-09-27T07:04:21Z","reason":"Error","startedAt":"2021-09-27T05:36:56Z"} | +-------------------------------+-------------+--------------+---------------------+----------+---------+-------+--------+----------------------------------------------------------------------------------------------------------+
The following table describes the parameters in the output.
Parameter
Description
INSTANCENAME
The name of the instance that runs the service.
INNERIP
The internal IP address of the instance.
HOSTIP
The IP address of the node to which the instance belongs.
STARTAT
The start time of the instance.
RESTARTS
The number of times that the instance restarted. The instance automatically restarts each time an Out of Memory (OOM) error or a crash caused by code errors occurs. Each time the instance is restarted, the value of the RESTARTS parameter increases by one.
STATUS
The status of the instance. A value of Pending indicates that the instance is waiting for resources. If the instance remains in the Pending state for a large amount of time, the instance cannot be used to run the service because of insufficient resources.
READY
The status of the containers in the instance. The value is in the format of
[Number of containers that are ready/Total number of containers in the instance]
.If the value of the READY parameter is [0/1], the container is starting or the container failed the health check. In this case, traffic does not go to the instance.
If the parameter value is [0/1] for all instances of a service, the service is unavailable and a
5xx
error code is returned when the service is requested.REASON
The description of the instance status.
LASTSTATE
The status of the instance after the last restart. If the value of the reason field in the LASTSTATE parameter is OOMKIlled, an OOM error occurs on the instance.
Create a stress testing task
Description
You can run the
bench create
command to create a stress testing task for a deployed service.Syntax
<eascmd64> bench create <bench_desc_json>
Parameters
bench_desc_json: the JSON file of the task. Sample file content:
{ "service": { "serviceName": "servicename_example" }, "data": { "content": "W1sxLDAsMCwwLDEsMSwwLDEsMCwxLDEsMCwwLDEsMCwxLDAsMSwwLDAsMSwxLDEsMCwxLDEsMCwwLDAsMSwxLDEsMCwxLDEsMSwxLDAsMSwxLDEsMCwxLDAsMCwwLDEsMSwwLDAsMCwxLDAsMSwwLDEsMCwwLDEsMCwwLDEsMCwxLDAsMCwxLDAsMCwwLDAsMSwwLDEsMCwxLDAsMCwxLDEsMSwwLDAsMSwwLDAsMCwwLDEsMSwxLDAsMSwxLDAsMCwxLDAsMSwwLDEsMSwxLDEsMCwxLDAsMCwxLDEsMSwxLDAsMCwwLDEsMSwwXV0K" } }
You can add the path parameter to the file to specify multiple OSS objects as the stress testing data. The following syntax provides a sample file content. To specify multiple stress testing data entries, add the entries to a compressed zip file and then specify the OSS path of the file in the oss://XX.zip format in the JSON file.
{ "service": { "serviceName": "servicename_example" }, "data": { "path": "oss://examplebucket/test1.bin,oss://examplebucket/test2.bin" } }
For more information about the parameters in the JSON file, see Create a stress testing task.
Example (In this example, the JSON file that describes the task information is named bench.json.)
<eascmd64> bench create bench.json
The system returns information similar to the following output:
[RequestId]: DE240637-4976-59AF-A28C-BAA55C0A**** [OK] Task [benchmark-servicename-example-b514] is creating [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 1/1]: Benchmark task is Running [OK] Benchmark task is Running [OK] Click the link http://127.0.0.1:18222/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-servicename-example-b514
Manage stress testing tasks
View stress testing tasks
Description
You can run the
bench list
command (orbench ls
) to view the stress testing tasks created by the current user.Syntax
<eascmd64> bench ls
Parameters
N/A
Example
<eascmd64> bench ls
The system returns information similar to the following output:
[RequestId]: 7F953F8E-8897-5785-808A-CA648302**** +-------------------------+--------------------------+-------------+----------------+---------+---------------------+ | TASKNAME | TASKID | REGION | AVAILABLEAGENT | STATUS | CREATETIME | +-------------------------+--------------------------+-------------+----------------+---------+---------------------+ | benchmark-xgb-test-7846 | eas-b-ql470xog6qeh25**** | cn-shanghai | 0 | Stopped | 2022-06-17 17:58:01 | | benchmark-xgb-test-b514 | eas-b-bdnzvwq0z0h3xq**** | cn-shanghai | 2 | Running | 2022-06-20 12:18:54 | +-------------------------+--------------------------+-------------+----------------+---------+---------------------+
View the details of a stress testing task
Description
You can run the
bench desc
command to view the details of a stress testing task.Syntax
<eascmd64> bench desc <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench desc benchmark-demo-test-c7eb
The system returns information similar to the following output:
+----------------+------------------------------------------------------------------------------+ | TaskName | benchmark-xgb-test-b514 | | TaskId | eas-b-bdnzvwq0z0h3xq**** | | ServiceName | xgb_test | | Region | cn-shanghai | | DesiredAgent | 2 | | AvailableAgent | 2 | | Status | Running | | Message | Benchmark task is running | | CreateTime | 2021-10-20 12:38:35 | | UpdateTime | 2021-10-20 12:38:45 | | Config | { | | | "base": { | | | "agentCount": 2, | | | "concurrency": 40, | | | "duration": 1200, | | | "requestCount": | | | 922337203685477****, | | | }, | | | ... | | | } | +----------------+------------------------------------------------------------------------------+
Enable real-time visualization for a stress testing task
Description
You can run the
bench visualize
command to enable real-time visualization for a stress testing task. This command allows you to access a web page that displays the real-time monitoring data of the stress testing task through 127.0.0.1 by using the web browser of your on-premises computer.Syntax
<eascmd64> bench visualize <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench visualize benchmark-xgb-test-b514
The system returns information similar to the following output:
[OK] Click the link http://127.0.0.1:18734/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-xgb-test-b514
Use your browser to visit
http://127.0.0.1:18734/eas-benchmark/statsview
to view the real-time monitoring data.
Stop a stress testing task
Description
You can run the
bench stop
command to stop a running stress testing task.Syntax
<eascmd64> bench stop <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench stop benchmark-xgb-test-b514
The system returns information similar to the following output:
Are you sure to stop the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Task [benchmark-xgb-test-b514] is stopping [OK] [Agnet: 0/1]: Benchmark task is Running [OK] [Agnet: 0/1]: Benchmark task is Stopped [OK] Benchmark task is stopped
Obtain the report of a stress testing task.
Description
You can run the
bench report
command to obtain the report of a stress testing task.NoteIf the stress testing task enters the Stopped state, the task is complete and the task report is stored in OSS.
Syntax
<eascmd64> bench report <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench report benchmark-xgb-test-b514
The system returns information similar to the following output:
[OK] Benchmark task benchmark-demo-test-c7eb report url: http://eas-benchmark.oss-cn-chengdu.aliyuncs.com/summary/benchmark-demo-test-c7eb-10004.html
Enter the URL displayed in the output into the address bar of your browser to view the task report.
Start a stress testing task
Description
You can run the
bench start
command to start a stopped stress testing task.Syntax
<eascmd64> bench start <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench start benchmark-xgb-test-b514
The system returns information similar to the following output:
Are you sure to start the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Task [benchmark-xgb-test-b514] is starting [OK] [Agnet: 0/1]: Succeed to start benchmark master [OK] [Agnet: 1/1]: Benchmark task is Running [OK] Benchmark task is Running [OK] Click the link http://127.0.0.1:18947/eas-benchmark/statsview to observe realtime visualization details, you can turn it off with CTRL+C. Turning off will not interrupt the benchmark test task, and you can reopen it by the visualize command: eascmd -c [config_file] bench visualize benchmark-xgb-test-b514
Dynamically modify the number of agent workers and concurrency
Description
If you set the stress testing mode to manual, you can run the
bench update
command to dynamically modify the number of agent workers and concurrency.Syntax
<eascmd64> bench update <benchmark_task_name> -Doptional.concurrency=<attr_value> -Doptional.agentCount=<attr_value>
Parameters
benchmark_task_name: the name of the stress testing task.
<attr_value>: the actual value.
Example
<eascmd64> bench update benchmark-demo-b99c -Doptional.concurrency=2 -Doptional.agentCount=1
The system returns information similar to the following output:
[RequestId]: 9920C672-4D41-5CC4-8EC0-C690F76E**** [OK] Running [TaskName: benchmark-demo-b99c, DesiredAgent:1, AvailableAgent: 1, Message: Benchmark task is Updating] [OK] Benchmark task benchmark-demo-b99c was updated successfully
Delete a stress testing task
Description
You can run the
bench delete
command to delete a stress testing task. After the task is deleted, the task report stored in OSS is also deleted.Syntax
<eascmd64> bench delete <benchmark_task_name>
Parameters
benchmark_task_name: the name of the stress testing task.
Example
<eascmd64> bench delete benchmark-xgb-test-b514
The system returns information similar to the following output:
Are you sure to delete the benchmark task [benchmark-xgb-test-b514] in [cn-shanghai]? [Y/n] [OK] Benchmark task benchmark-xgb-test-b514 is Deleting [OK] Benchmark task was deleted successfully
Delete or restart one or more instances
Description
You can run the
deleteworkers
ordw
command to delete one or more instances for a service. After one or more instances are deleted, the system automatically starts new instances to reach the specified number of allocated instances. Therefore, you can also run this command to restart instances.Syntax
<eascmd64> dw <service_name> <instance_names>
Parameters
<service_name>: the name of the service.
<instance_names>: the name of the instance that you want to delete. You can specify multiple instance names. Separate multiple instance names with commas (,).
Example
<eascmd64> dw mnist_saved_model_example mnist-saved-model-example-69cf5dd6c7-5****
The system returns information similar to the following output:
Are you sure to delete the instances [mnist-saved-model-example-69cf5dd6c7-5****] of service [mnist_saved_model_example] in [cn-shenzhen]? [Y/n]
Press the Y key. The system returns information similar to the following output:
[RequestId]: 564C8F56-D97A-555E-9E0B-22BE140A**** [OK] Instance(s) [mnist-saved-model-example-69cf5dd6c7-5****] for service [mnist_saved_model_example] in region [cn-shenzhen] was deleted successfully
Initialize the Python SDK environment
This operation is supported only in the Linux operating system.
Description
You can run
pysdk init
command to initialize the Python SDK environment.Syntax
<eascmd64> pysdk init ./pysdk_demo
Parameters
N/A
Example
Run the following command to perform an initialization operation:
<eascmd64> pysdk init ./pysdk_demo
The system returns information similar to the following output:
[PYSDK] Please choose your python version [enter for 3.6]:
Enter 3.6. The system displays information similar to the following output:
Collecting package metadata (current_repodata.json): done Solving environment: done ... [PYSDK] Installing python processor example app.py [PYSDK] Installing python service example app.json
Compress the complete environment and code
This operation is supported only in the Linux operating system.
Description
You can run the
pysdk pack
command to compress the complete environment and code.Syntax
<eascmd64> pysdk pack ./<demo>
Parameters
<demo>: the directory that stores the environment or code.
Example (In this example, the directory that stores the environment or code is demo.)
<eascmd64> pysdk pack ./demo
The system returns information similar to the following output:
[PYSDK] Creating package: /mnt/workspace/demo.tar.gz
View resource groups
Description
You can run the
resource list
orresource ls
command to view the resource groups within the current account.Syntax
<eascmd64> resource ls
Parameters
N/A
Example
<eascmd64> resource ls
The system returns information similar to the following output:
+--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+ | RESOURCENAME | CLUSTERID | INSTANCECOUNT | GPUCOUNT | CPUCOUNT | OWNERUID | CREATETIME | STATUS | +--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+ | eas-r-lzo32vrdbtukr7te3i | cn-shanghai | 1 | 0 | 16 | 182848887922**** | 2020-03-18 13:09:24 | ResourceReady | +--------------------------+-------------+---------------+----------+----------+------------------+---------------------+---------------+
View the details of a resource group
Description
You can run the
resource desc
command to view the details of a resource group.Syntax
<eascmd64> resource desc <resource_id>
Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource list
or resource ls command.Example
View the details of a resource group whose ID is eas-r-lzo32vrdbtukr7te3i.
<eascmd64> -c ~/.eas/shanghai2.conf resource desc eas-r-lzo32vrdbtukr7te3i
The -c ~/.eas/shanghai2.conf part indicates that a custom configuration file is used instead of the default configuration file ~/.eas/config. The system returns information similar to the following output:
+---------+-----------------+----------------------------------------------------------+ | Basic | ResourceName | eas-r-lzo32vrdbtukr7te3i | | | Region | cn-shanghai | | | CpuCount | 16 | | | GpuCount | 0 | | | instanceCount | 1 | | | CreateTime | 2020-03-18 13:09:24 | | | LastStatus | ResourceReady | | | Message | Resource is ready | | | RoleArn | acs:ram::xxx:role/AliyunPAIAccessingENIRole | | Network | VpcId | vpc-uf6s9pv47nu03srne**** | | | VSwitchId | vsw-uf6voq53e893k56ws**** | | | SecurityGroupId | sg-uf6c5twkfar8l06c**** | | | DestinationCIDR | | | | AuxVSwitchList | [] | +---------+-----------------+----------------------------------------------------------+
View the instances in a resource group
Description
You can run the
resource list_instance
orresource li
command to view the instances in a resource group and the resource usage of each instance.Syntax
<eascmd64> resource list_instance <resource_id>
Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource list
or resource ls command.Example
<eascmd64> resource li eas-r-lzo32vrdbtukr7te3i
The system returns information similar to the following output:
+------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+ | INSTANCENAME | INSTANCEIP | STATUS | TOTAL/USED CPU | TOTAL/USED GPU | TOTAL/USED MEMORY | CREATETIME | INSTANCETYPE | CHARGETYPE | +------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+ | cn-shanghai.i-uf6dj71ir6mh3gjmaz3a | 10.224.XX.XX | Ready | 16/6 | 0/0 | 62240M/4200M | 2020-03-18 13:09:34 | ecs.g6.4xlarge | PostPaid | +------------------------------------+--------------+--------+----------------+----------------+-------------------+---------------------+----------------+------------+
Enable direct connection for a resource group
Description
You can run the
resource network
command to enable direct connection for a resource group. This way, you can establish a connection between the EAS virtual private cloud (VPC) and your VPC. You can call services in EAS from your VPC by establishing a direct connection to a software-based load balancer. You can also access internal network resources, such as ApsaraDB RDS and ApsaraDB for Redis, in your VPC by using a processor in EAS.Syntax
<eascmd64> resource network <resource_id> -s <network_cfg.json>
Parameters
<resource_id>: the ID of the resource group that you want to view. You can obtain the ID from the RESOURCENAME parameter in the output of the
resource list
or resource ls command.<network_cfg.json>: the network configuration file. The following information shows the format of the file:
{ "Action":"create", "VSwitchId": "vsw-8vbsunr5bkcbyxh94****", "SecurityGroupId": "sg-8vbhwowdxzx5fjcx****", "VSwitchIdList": ["vsw-8xbsunr5abcbyqh93****", "vsw-8xbs1y7gu6cxbvqzw****"], "DestinationCIDR": "192.XX.XX.XX/16" }
The following table describes the parameters in the file.
Parameter
Description
Required
Default value
Action
Specifies whether to enable direct connection for the resource group. Valid values:
create: enables direct connection.
delete: disables direct connection. In this case, other parameters are not required.
Yes
N/A
VSwitchId
The ID of the primary vSwitch for which you want to enable direct connection. EAS automatically creates an elastic network interface (ENI) in the vSwitch. Do not delete the ENI. Otherwise, connections may fail.
Yes
N/A
SecurityGroupId
The ID of the security group to which the Elastic Compute Service (ECS) instances where the clients are deployed belong.
NoteThe ECS instances must belong to this security group. Otherwise, connections may fail.
Yes
N/A
VSwitchIdList
The IDs of the secondary vSwitches for which you want to enable direct connection. The secondary vSwitches must belong to the same VPC as the primary vSwitch. The system automatically adds the CIDR blocks of the secondary vSwitches to the routing rules in EAS.
No
Empty array ([])
DestinationCIDR
The CIDR block of the client for which you want to enable direct connection. The client must belong to the same VPC as the primary vSwitch. The system automatically adds the CIDR block to the routing rules in EAS.
No
Empty string ("")
NoteThe VSwitchIdList parameter works in the same way as the DestinationCIDR parameter. Both parameters are used to establish a connection between the EAS cluster and a specific CIDR block of your VPC. If you want to connect to multiple specified vSwitches, use the VSwitchIdList parameter. If you want to connect to a large CIDR block, such as the CIDR block of the entire VPC, use the DestinationCIDR parameter. We recommend that you do not use the 10.0.0.0/8, 10.224.0.0/16, or 10.240.0.0/16 CIDR block. Otherwise, network conflicts may occur. If you have other requirements, contact your account manager.
References
You can use the HTTP URL that is generated when you create a service to call the prediction service. The input and output formats of the prediction service are defined by the processor that you use. For more information, see topics in the Construct requests for services based on a universal processor chapter.
For more information about how to create and manage services in the console, see Model service deployment by using the PAI console.