创建端点
功能介绍
创建端点。用户可使用该接口在工作空间下创建端点,输入名称、描述、类型、资源配置、cap配置等信息,返回端点信息。此接口为异步接口,配套使用接口ShowEndpoint查询端点详情,无特殊场景。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST https://localhost.com/v1/workspaces/{workspace_id}/endpoints
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
workspace_id |
是 |
String |
|
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
否 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
是 |
String |
|
description |
否 |
String |
|
type |
是 |
String |
|
reserved_resource |
否 |
ReservedResource object |
|
ray_resource |
否 |
RayResourceInput object |
|
cap |
否 |
CapRef object |
|
config |
否 |
EndpointConfig object |
|
cache_list |
否 |
Array of CacheConfig objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
apu |
否 |
ResourceDef object |
|
dpu |
否 |
SqlResourceDef object |
|
mu |
否 |
ResourceDemand object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
spec_code |
是 |
String |
|
warm_up_num |
是 |
Integer |
|
max_num |
否 |
Integer |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
spec_code |
是 |
String |
|
warm_up_num |
是 |
Integer |
|
max_num |
否 |
Integer |
|
use_public_resource |
否 |
Boolean |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
head_node_resource |
是 |
HeadNodeResourceDemand object |
|
work_node_resources |
是 |
Array of WorkNodeResourceDemand objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
spec_code |
是 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
是 |
String |
|
resource |
是 |
ResourceDemand object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
spec_code |
是 |
String |
|
min |
是 |
Integer |
|
max |
是 |
Integer |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
cap_id |
否 |
String |
|
version_id |
否 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
ray_service_config |
否 |
RayServiceConfig object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
ray_serve_config |
是 |
RayServeConfig object |
|
ray_cluster_config |
是 |
RayClusterConfig object |
|
log_config |
否 |
RayServiceLogConfig object |
|
data_infos |
否 |
Array of DataBriefInfo objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
applications |
否 |
Array of ServeApplication objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
是 |
String |
|
import_path |
是 |
String |
|
deployments |
是 |
Array of Deployment objects |
|
runtime_env |
是 |
ServeRuntimeEnv object |
|
route_prefix |
否 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
否 |
String |
|
ray_actor_options |
否 |
RayActorOptions object |
|
autoscaling_config |
否 |
AutoscalingConfig object |
|
num_replicas |
否 |
Integer |
|
user_config |
否 |
Object |
|
max_replicas_per_node |
否 |
Integer |
|
max_ongoing_requests |
否 |
Integer |
|
max_queued_requests |
否 |
Integer |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
num_cpus |
否 |
Double |
|
memory |
否 |
Double |
|
resources |
否 |
String |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
target_ongoing_requests |
否 |
Integer |
|
min_replicas |
否 |
Integer |
|
max_replicas |
否 |
Integer |
|
initial_replicas |
否 |
Integer |
|
upscale_delay_s |
否 |
Integer |
|
downscale_delay_s |
否 |
Integer |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
working_dir |
否 |
String |
|
env_vars |
否 |
Map<String,String> |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
head_group_spec |
是 |
HeadGroupSpecV2 object |
|
worker_group_specs |
是 |
Array of WorkerGroupSpecV2 objects |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
limits |
否 |
ResourceSpec object |
|
requests |
否 |
ResourceSpec object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
name |
否 |
String |
|
min_replicas |
否 |
Integer |
|
max_replicas |
否 |
Integer |
|
limits |
否 |
ResourceSpec object |
|
requests |
否 |
ResourceSpec object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
lts |
否 |
RayServiceLogLtsConfig object |
|
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
enabled |
否 |
Boolean |
|
log_group_id |
否 |
String |
|
log_stream_id |
否 |
String |
|
响应参数
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:408
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
|
error_msg |
String |
|
solution_msg |
String |
|
请求示例
创建端点。具体规格如样例展示。
POST https://{endpoint}/v1/workspaces/{workspace_id}/endpoints
{
"name" : "endpoint1",
"description" : "description",
"type" : "job",
"reserved_resource" : {
"apu" : {
"spec_code" : "dpu.d1x",
"warm_up_num" : 1,
"max_num" : 100
},
"dpu" : {
"spec_code" : "dpu.d1x",
"warm_up_num" : 4,
"max_num" : 100
},
"mu" : {
"spec_code" : "string",
"min" : 0,
"max" : 1
}
},
"ray_resource" : {
"head_node_resource" : {
"spec_code" : "string"
},
"work_node_resources" : [ {
"name" : "cpuGroup1",
"resource" : {
"spec_code" : "string",
"min" : 0,
"max" : 1
}
} ]
},
"cap" : {
"cap_id" : "0b5633ba2b904511ad514346f4d23d4b",
"version_id" : "0b5633ba2b904511ad514346f4d23d4b"
},
"config" : {
"ray_service_config" : {
"log_config" : {
"lts" : {
"enabled" : true,
"log_group_id" : "string",
"log_stream_id" : "string"
}
},
"ray_serve_config" : {
"applications" : [ {
"name" : "string",
"import_path" : "string",
"deployments" : [ {
"name" : "string",
"ray_actor_options" : {
"num_cpus" : 0,
"memory" : 0,
"resources" : "string"
},
"autoscaling_config" : {
"target_ongoing_requests" : 1000,
"max_ongoing_requests" : 1000,
"min_replicas" : 1000,
"max_replicas" : 1000,
"initial_replicas" : 1000,
"upscale_delay_s" : 86400,
"downscale_delay_s" : 86400
},
"num_replicas" : 1000,
"user_config" : { },
"max_replicas_per_node" : 1
} ],
"runtime_env" : {
"working_dir" : "string",
"env_vars" : {
"additionalProp1" : "string",
"additionalProp2" : "string",
"additionalProp3" : "string"
}
},
"route_prefix" : "string"
} ]
},
"ray_cluster_config" : {
"head_group_spec" : {
"limits" : {
"spec_code" : "string"
},
"requests" : {
"spec_code" : "string"
}
},
"worker_group_specs" : [ {
"name" : "string",
"min_replicas" : 10000,
"max_replicas" : 10000,
"limits" : {
"spec_code" : "string"
},
"requests" : {
"spec_code" : "string"
}
} ]
},
"data_infos" : [ {
"input_path" : "OBS://bucket/dir/"
} ]
}
},
"cache_list" : [ {
"mnt_path" : "string",
"cache_ins_id" : "string"
} ]
}
响应示例
状态码:202
查询endpoint详情的响应。
{
"visibility" : "PRIVATE",
"id" : "0b5633ba2b904511ad514346f4d23d4b",
"name" : "endpoint1",
"type" : "job",
"status" : "CREATING",
"description" : "description",
"create_time" : "2023-05-30T12:24:30.401Z",
"update_time" : "2023-05-30T12:24:30.401Z",
"owner" : {
"domain_name" : "string",
"domain_id" : "0b5633ba2b904511ad514346f4d23d4b",
"user_name" : "string",
"user_id" : "0b5633ba2b904511ad514346f4d23d4b"
},
"cap" : {
"cap_id" : "0b5633ba2b904511ad514346f4d23d4b",
"version_id" : "0b5633ba2b904511ad514346f4d23d4b"
},
"reserved_resource" : {
"apu" : {
"spec_code" : "dpu.d1x",
"warm_up_num" : 1,
"max_num" : 100
},
"dpu" : {
"spec_code" : "dpu.d1x",
"warm_up_num" : 1,
"max_num" : 100,
"use_public_resource" : false
},
"mu" : {
"spec_code" : "string",
"min" : 0,
"max" : 1
}
},
"ray_resource" : {
"head_group_spec" : {
"spec_code" : "string"
},
"worker_group_spec" : [ {
"name" : "string",
"spec_code" : "string",
"min_replicas" : 10000,
"max_replicas" : 10000
} ]
},
"caches" : [ {
"mnt_path" : "string",
"cache_ins_id" : "string"
} ],
"error_code" : "string",
"error_msg" : "string",
"urls" : [ {
"name" : "string",
"address" : "string",
"type" : "PRIVATE",
"token" : "string"
} ],
"business_engine_instance_ids" : [ "string" ],
"tokens_quota" : {
"total" : 0,
"used" : 0,
"expire_time" : "2025-01-17T01:12:24.663Z"
},
"runtime_env_type" : "RELEASE",
"config" : {
"ray_service_config" : {
"log_config" : {
"lts" : {
"enabled" : true,
"log_group_id" : "string",
"log_stream_id" : "string"
}
},
"ray_serve_config" : {
"applications" : [ {
"name" : "string",
"import_path" : "string",
"deployments" : [ {
"name" : "string",
"ray_actor_options" : {
"num_cpus" : 0,
"memory" : 0,
"resources" : "string"
},
"autoscaling_config" : {
"target_ongoing_requests" : 1000,
"max_ongoing_requests" : 1000,
"min_replicas" : 1000,
"max_replicas" : 1000,
"initial_replicas" : 1000,
"upscale_delay_s" : 86400,
"downscale_delay_s" : 86400
},
"num_replicas" : 1000,
"user_config" : { },
"max_replicas_per_node" : ""
} ],
"runtime_env" : {
"working_dir" : "string",
"env_vars" : {
"additionalProp1" : "string",
"additionalProp2" : "string",
"additionalProp3" : "string"
}
},
"route_prefix" : "string"
} ]
},
"ray_cluster_config" : {
"head_group_spec" : {
"limits" : {
"spec_code" : "string"
},
"requests" : {
"spec_code" : "string"
}
},
"worker_group_specs" : [ {
"name" : "string",
"min_replicas" : 10000,
"max_replicas" : 10000,
"limits" : {
"spec_code" : "string"
},
"requests" : {
"spec_code" : "string"
}
} ]
},
"data_infos" : [ {
"input_path" : "OBS://bucket/dir/",
"output_path" : "OBS://bucket/dir/",
"env_var_name" : "string"
} ]
}
}
}
状态码:400
BadRequest
{
"error_code" : "common.01000001",
"error_msg" : "failed to read http request, please check your input, code: 400, reason: Type mismatch., cause: TypeMismatchException"
}
状态码:401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
状态码:403
Forbidden
{
"error" : {
"code" : "403",
"message" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
},
"error_code" : 403,
"error_msg" : "X-Auth-Token is invalid in the request",
"title" : "Forbidden"
}
状态码:408
Request Time-out
{
"error_code" : "common.00000408",
"error_msg" : "timeout exception occurred"
}
状态码:500
InternalServerError
{
"error_code" : "common.00000500",
"error_msg" : "internal error"
}
状态码
状态码 |
描述 |
---|---|
202 |
查询endpoint详情的响应。 |
400 |
BadRequest |
401 |
Unauthorized |
403 |
Forbidden |
408 |
Request Time-out |
500 |
InternalServerError |
错误码
请参见错误码。