Creating a Development Environment Instance
Function
This API is used to create a development environment instance for code development.
Calling this API is an asynchronous operation. The job status can be obtained by calling the API described in Querying the Details About a Development Environment Instance.
URI
POST /v1/{project_id}/demanager/instances
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Body
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Instance name, which contains a maximum of 64 characters. The value can contain uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). |
|
profile_id |
Yes |
String |
Configuration ID. Possible values are as follows:
|
|
description |
No |
String |
Instance description. The value contains a maximum of 512 characters and cannot contain the following special characters: <>"'/. By default, this parameter is left blank. |
|
flavor |
Yes |
String |
Instance flavor. Currently, the options are as follows:
The preceding flavors are for reference only. The actual flavors depend on the region. If you need to use other flavors, submit a service ticket to change the flavors. |
|
spec |
Yes |
Object |
Instance definition. Currently, only notebook is supported. For example, see Table 3. |
|
workspace |
No |
Object |
Workspace. The default workspace ID is 0. For details, see Table 7. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
storage |
Yes |
Object |
Storage path. For details, see Table 4. |
|
auto_stop |
No |
Object |
Auto stop parameter. For details, see Table 6. |
|
annotations |
No |
Object |
Label information, which can be extended. By default, this parameter is left blank. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
type |
Yes |
String |
Storage type. Only obs and evs are supported. |
|
location |
No |
Object |
Storage location. If type is set to obs, this parameter is mandatory. See Table 5. By default, this parameter is left blank. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
path |
No |
String |
Storage path
|
|
volume_size |
No |
Integer |
EVS disk size. The minimum size is 5 GB and the maximum size is 4,096 GB. The default value is 5 GB. If type is set to obs, this parameter does not need to be set. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
enable |
No |
Boolean |
Whether to enable the auto stop function. The value true indicates that the function is enabled and the instance will automatically stop when the running duration is reached. The value false indicates that the function is disabled. The default value is false. |
|
duration |
No |
Integer |
Running duration, in seconds. The value ranges from 3,600 to 86,400. After this parameter is set, it is valid for each startup. This parameter is mandatory when enable is set to true. |
|
prompt |
No |
Boolean |
Whether to display a prompt again. This parameter is provided for the console to determine whether to display a prompt again. The default value is true. |
Response Body
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Instance ID |
|
name |
String |
Instance name |
|
description |
String |
Instance description |
|
status |
String |
Instance status |
|
creation_timestamp |
String |
Time when an instance is created |
|
latest_update_timestamp |
String |
Time when an instance is modified |
|
profile |
Object |
Configuration information. For details, see Table 9. |
|
flavor |
String |
Instance flavor |
|
flavor_details |
Object |
For details about the flavor, see Table 13. |
|
pool |
Object |
For details about the dedicated resource pool, see Table 14. |
|
spec |
Object |
Instance definition For details about parameters of a notebook instance, see Table 16. |
|
workspace |
Object |
Workspace. For details, see Table 19. |
|
ai_project |
Object |
AI project |
|
error_code |
String |
Error code. For details, see Error Code. |
|
queuing_info |
Object |
Queuing information. For details, see Table 20. |
|
user |
Object |
User information. For details, see Table 21. |
|
repository |
Object |
Git repository information. This parameter cannot be used. It is automatically returned when the API is called. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Configuration ID |
|
name |
String |
Configuration name |
|
description |
String |
Configuration description |
|
de_type |
String |
Development environment type. Currently, only notebook is supported. |
|
flavor_type |
String |
Hardware, including CPU, GPU, and Ascend. |
|
provision |
Object |
Deployment information. For details, see Table 10. |
|
labels |
Dict |
Label |
|
Parameter |
Type |
Description |
|---|---|---|
|
type |
String |
Deployment type. Currently, only Docker is supported. |
|
spec |
Object |
Deployment details. For details, see Table 11. |
|
annotations |
Object |
Label information, which can be extended. By default, this parameter is left blank. |
|
Parameter |
Type |
Description |
|---|---|---|
|
engine |
String |
Deployment engine. Currently, only CCE is supported. |
|
params |
Object |
Deployment parameters. Currently, only Docker is supported. For details, see Table 12. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
name |
Yes |
String |
Flavor name |
|
status |
Yes |
String |
Flavor sale status The options are as follows:
|
|
queuing_num |
No |
Integer |
This parameter is mandatory when promo_type is set to Free and status is set to soldOut. |
|
queue_left_time |
No |
Integer |
Left queuing time, in seconds This parameter is mandatory when promo_type is set to Free and status is set to soldOut. |
|
storage_list |
No |
List< storageType > |
Supported storage type. The options are obs, evs, and efs.
|
|
is_permitted |
No |
String |
Whether the current user has the permission to use this flavor |
|
type |
Yes |
String |
Flavor status. The options are as follows:
|
|
params |
Yes |
Dict |
Parameters that describing flavor |
|
promo_type |
No |
String |
Promotion type. The options are as follows:
|
|
instance_num |
No |
Integer |
Number of instances of this flavor the current created |
|
duration |
No |
Integer |
Auto stop time after startup, in seconds |
|
store_time |
No |
Integer |
Maximum retention period of an inactive instance of this flavor in the database, in hours The default value is -1, indicating that the instance can be permanently saved. |
|
billing_flavor |
No |
String |
Billing specifications. If this field is left blank, the specifications name is used for billing. |
|
billing_params |
No |
Integer |
Billing ratio This parameter is mandatory when billing_flavor is specified. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
ID of a resource pool |
|
name |
No |
String |
Name of a resource pool |
|
type |
No |
String |
Type of a resource pool. USER_DEFINED indicates a dedicated resource pool. |
|
owner |
No |
Dict |
This parameter is mandatory when type is set to USER_DEFINED. For details, see Table 15. |
|
Parameter |
Type |
Description |
|---|---|---|
|
log_path |
String |
Path for storing custom image logs |
|
custom_script_path |
String |
Path for storing custom initialization scripts used when a notebook instance is started |
|
storage |
Object |
Storage path |
|
credential |
Object |
AK and SK for accessing OBS |
|
resource_reserved_timestamp |
Integer |
Time when the resource is reserved |
|
auto_stop |
Object |
Auto stop parameter. For details, see Table 18. |
|
failed_reasons |
Object |
Cause for creation or startup failures. See Table 17. |
|
annotations |
Dict |
Annotations The generated URL cannot be directly accessed. |
|
extend_params |
Dict |
Extended parameter |
|
Parameter |
Type |
Description |
|---|---|---|
|
code |
String |
Error code. |
|
message |
String |
Error message |
|
detail |
Dict |
Error details |
|
Parameter |
Type |
Description |
|---|---|---|
|
enable |
Boolean |
Whether to enable the auto stop function |
|
duration |
Integer |
Running duration, in seconds |
|
prompt |
Boolean |
Whether to display a prompt again. This parameter is provided for the console to use. |
|
stop_timestamp |
Integer |
Time when the instance stops. The value is a 13-digit timestamp. |
|
remain_time |
Integer |
Remaining time before actual stop, in seconds |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
id |
Yes |
String |
Instance ID |
|
name |
No |
String |
Instance name |
|
de_type |
No |
String |
Development environment type. By default, all types are returned. Currently, only the notebook is supported. |
|
flavor |
No |
String |
Instance flavor. By default, all types are returned. Currently, the options are as follows:
|
|
flavor_details |
No |
Object |
Flavor details, which display the flavor information and whether the flavor is sold out For details, see Table 13. |
|
status |
Yes |
String |
Instance status. By default, all statuses are returned, including:
|
|
begin_timestamp |
Yes |
Integer |
Time when an instance starts queuing. The value is a 13-digit timestamp. |
|
remain_time |
Yes |
Integer |
Left queuing time, in seconds |
|
end_timestamp |
No |
Integer |
Time when an instance completes queuing. The value is a 13-digit timestamp. |
|
rank |
Yes |
Integer |
Ranking of an instance in a queue |
Samples
The following shows how to create the notebook-instance instance whose configuration ID is Python3-gpu.
- Sample request
{ "name": "notebook-instance", "description": "", "profile_id": "Python3-gpu", "flavor": "modelarts.bm.gpu.v100NV32", "spec": { "storage": { "location": { "volume_size": 5 }, "type": "evs" }, "auto_stop": { "enable": true, "duration": 3600 } }, "workspace": { "id": "0" } }
- Successful sample response
{ "ai_project": { "id": "default-ai-project" }, "creation_timestamp": "1594887749962", "description": "", "flavor": "modelarts.bm.gpu.v100NV32", "flavor_details": { "name": "modelarts.bm.gpu.v100NV32", "params": { "CPU": 8, "GPU": 1, "gpu_type": "v100NV32", "memory": "64GiB" }, "status": "onSale", "type": "GPU" }, "id": "DE-7d558ef8-c73d-11ea-964c-0255ac100033", "latest_update_timestamp": "1594887749962", "name": "notebook-c6fd", "profile": { "de_type": "Notebook", "description": "multi engine, gpu, python 3.6 for notebook", "flavor_type": "GPU", "id": "Python3-gpu", "name": "Python3", "provision": { "annotations": { "category": "Multi-Engine (Recommend)", "flavor": "modelarts.vm.gpu.p100", "type": "system" }, "spec": { "engine": "CCE", "params": { "image_name": "mul-kernel-gpu-cuda-cp36", "image_tag": "2.0.5-B003", "namespace": "atelier" } }, "type": "Docker" } }, "spec": { "annotations": { "target_domain": "https://modelarts-notebook-2.cn-north-4.myhuaweicloud.com", "url": "" }, "auto_stop": { "duration": 3600, "enable": true, "prompt": true }, "extend_params": null, "failed_reasons": null, "repository": null, "storage": { "location": { "path": "/home/ma-user/work", "volume_size": 5, "volume_unit": "GB" }, "type": "evs" } }, "status": "CREATING", "user": { "id": "15dda26361214ca2a5953917d2f48ffb", "name": "ops_dev_env" }, "workspace": { "id": "0" } }
- Failed sample response
{ "error_msg": "The param path needs to end with /.", "error_code": "ModelArts.6318" }
Status Code
For details about the status code, see Status Code.
Last Article: Development Environment
Next Article: Querying the List of Development Environment Instances
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.