云服务器内容精选

  • URI PUT /v2/{project_id}/workflows/{workflow_id}/executions/{execution_id} 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 用户项目ID。获取方法请参见获取项目ID和名称。 workflow_id 是 String 工作流的ID。 execution_id 是 String 工作流执行ID。
  • 响应示例 状态码: 200 OK { "created_at" : "2022-06-16T23:12:48.458022+08:00", "name" : "execution-056", "execution_id" : "fa412c98-6d94-42a2-891a-99cd1da93916", "description" : "", "status" : "stopped", "workspace_id" : "0", "workflow_id" : "f1642618-43eb-4ab1-a0b1-9cc584182c60", "workflow_name" : "workflow_model_service_no_modify_xiahou_copy", "steps_execution" : [ { "created_at" : "2022-06-16T23:12:48.466906+08:00", "uuid" : "5e8456bd-35ff-4cc9-9624-935c37dabe47", "instance_id" : "{\"model_id\":\"7d795a48-e646-43b0-b4cb-759454acaf2b\"}", "step_name" : "model_step", "step_title" : "model release", "status" : "completed", "duration" : 17, "inputs" : [ { "name" : "model_input", "type" : "obs", "data" : "$ref/data_requirements/model_input", "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/test-crq/train_output/" } } ], "outputs" : [ { "name" : "model_output", "type" : "model", "config" : { "model_id" : "7d795a48-e646-43b0-b4cb-759454acaf2b" } } ], "properties" : { "model_name" : "lh-xh", "model_type" : "TensorFlow" }, "events" : [ "2022-06-16 23:12:49 change status from init to creating", "2022-06-16 23:12:51 change status from creating to created", "2022-06-16 23:12:51 change status from created to running", "2022-06-16 23:13:05 change status from running to completed" ], "policy" : { } }, { "created_at" : "2022-06-16T23:13:05.620354+08:00", "uuid" : "9b452016-cc7b-4bfe-snt9-f9d53dcb4cc1", "step_name" : "service_step", "step_title" : "service install", "status" : "stopped", "duration" : 1, "events" : [ "2022-06-16 23:13:06 change status from init to wait_inputs", "2022-06-16 23:16:13 change status from wait_inputs to stopped" ], "policy" : { } } ], "duration" : 204, "events" : [ "2022-06-16 23:12:49 step model_step change status from init to creating", "2022-06-16 23:12:51 step model_step change status from creating to created", "2022-06-16 23:12:51 step model_step change status from created to running", "2022-06-16 23:13:05 step model_step change status from running to completed", "2022-06-16 23:13:06 step service_step change status from init to wait_inputs", "2022-06-16 23:16:13 step service_step change status from wait_inputs to stopped" ], "data_requirements" : [ { "name" : "model_input", "type" : "obs", "conditions" : [ { "attribute" : "object_type", "operator" : "equal", "value" : "directory" } ], "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/test-crq/train_output/" }, "used_steps" : [ "model_step" ] }, { "name" : "service_model", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "lh-xh" } ], "used_steps" : [ "service_step" ] } ], "parameters" : [ { "name" : "schedule_d5sm", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "used_steps" : [ "service_step" ] } ], "policies" : { } }
  • 响应示例 状态码: 200 OK { "created_at" : "2021-12-14T11:34:24.541809+08:00", "workflow_id" : "a8f31367-3534-4644-a2fe-75d187341ae7", "name" : "demo_workflow", "description" : "this is a demo workflow", "user_name" : "ei_modelarts_z00424192_01", "workspace_id" : "0", "steps" : [ { "created_at" : "2021-12-14T11:34:24.545451+08:00", "name" : "model_step", "title" : "model release", "description" : "", "type" : "model", "inputs" : [ { "name" : "model_input", "type" : "obs", "data" : "$ref/data_requirements/model_input" } ], "outputs" : [ { "name" : "model_output", "type" : "model" } ], "properties" : { "model_name" : "model-name-xh", "model_type" : "TensorFlow" }, "policy" : { } }, { "created_at" : "2021-12-14T11:34:24.549514+08:00", "name" : "service_step", "title" : "service install", "description" : "", "type" : "service", "inputs" : [ { "name" : "service_input", "type" : "model_list", "data" : "$ref/data_requirements/service_model" } ], "outputs" : [ { "name" : "service_output", "type" : "service" } ], "properties" : { "infer_type" : "real-time", "schedule" : "$ref/parameters/schedule_d0MY" }, "depend_steps" : [ "model_step" ], "policy" : { } } ], "data_requirements" : [ { "name" : "model_input", "type" : "obs", "conditions" : [ { "attribute" : "object_type", "operator" : "equal", "value" : "directory" } ], "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/cwf-test/csv/" }, "used_steps" : [ "model_step" ] }, { "name" : "service_model", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "model-name-xh" } ], "used_steps" : [ "service_step" ] } ], "parameters" : [ { "name" : "schedule_1zHw", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "used_steps" : [ "service_step" ] } ], "policy" : { }, "last_modified_at" : "2022-05-20T14:16:40.373445+08:00" }
  • 请求示例 更新工作流信息 PUT https://{endpoint}/v2/{project_id}/workflows/a8f31367-3534-4644-a2fe-75d187341ae7 { "parameters" : [ { "name" : "schedule_1zHw", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "used_steps" : [ "service_step" ] } ], "smn_switch" : true }
  • 响应示例 状态码: 201 create image save job successfully { "name" : "imagesave", "namespace" : "dev", "tag" : 0.1, "description" : "hello world!", "status" : "ACTIVE", "message" : "building", "create_time" : 1686718209968 }
  • URI POST /v2/{project_id}/training-jobs/{training_job_id}/tasks/{task_id}/save-image-job 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 用户项目ID。获取方法请参见获取项目ID和名称。 training_job_id 是 String 训练作业ID。 task_id 是 String 训练作业的任务名称。可从训练作业详情中的status.tasks字段中获取。
  • 请求示例 如下以创建uuid为2cd88daa-31a4-40a8-a58f-d186b0e93e4f的训练作业对应worker-0镜像保存任务为例。 POST https://endpoint/v2/{project_id}/training-jobs/2cd88daa-31a4-40a8-a58f-d186b0e93e4f/tasks/worker-0/save-image-job { "name" : "imagesave", "namespace" : "dev", "tag" : 0.1, "description" : "hello world!" }
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 name 否 String 镜像名称,长度限制512个字符,支持小写字母、数字、中划线、下划线和点。 namespace 否 String 镜像所属组织,可以在SWR控制台“组织管理”创建和查看。 tag 否 String 镜像tag,长度限制64个字符, 支持大小写字母、数字、中划线、下划线和点。 description 否 String 该镜像所对应的描述信息,长度限制512个字符。 status 否 String 镜像状态。枚举值如下: INIT:初始化。 CREATING:镜像保存中,此时训练作业不可用。 CREATE_FAILED:镜像保存失败。 ACTIVE:镜像保存成功,保存的镜像可以在SWR控制台查看,同时可以基于保存的镜像创建训练作业。 message 否 String 镜像保存操作过程中,构建信息展示。 create_time 否 Long 镜像创建的时间,UTC毫秒。
  • 响应参数 状态码: 201 表3 响应Body参数 参数 参数类型 描述 name String 镜像名称,长度限制512个字符,支持小写字母、数字、中划线、下划线和点。 namespace String 镜像所属组织,可以在SWR控制台“组织管理”创建和查看。 tag String 镜像tag,长度限制64个字符, 支持大小写字母、数字、中划线、下划线和点。 description String 该镜像所对应的描述信息,长度限制512个字符。 status String 镜像状态。枚举值如下: INIT:初始化。 CREATING:镜像保存中,此时训练作业不可用。 CREATE_FAILED:镜像保存失败。 ACTIVE:镜像保存成功,保存的镜像可以在SWR控制台查看,同时可以基于保存的镜像创建训练作业。 message String 镜像保存操作过程中,构建信息展示。 create_time Long 镜像创建的时间,UTC毫秒。
  • 响应示例 状态码: 200 OK { "total" : 1, "count" : 1, "items" : [ { "created_at" : "2022-06-17T17:08:16.91019+08:00", "name" : "execution-064", "execution_id" : "918cd9bd-62dd-4179-b5f0-773dd7184a56", "description" : "", "status" : "completed", "workspace_id" : "0", "workflow_id" : "f1642618-43eb-4ab1-a0b1-9cc584182c60", "workflow_name" : "workflow_model_service_no_modify_xiahou_copy", "steps_execution" : [ { "created_at" : "2022-06-17T17:08:16.920281+08:00", "uuid" : "d6148a4a-4a5e-47a3-bc90-3183905b4941", "instance_id" : "{\"model_id\":\"253aba02-4bd6-4f64-8d37-66022ae7af4d\"}", "step_name" : "model_step", "step_title" : "model release", "status" : "completed", "duration" : 16, "inputs" : [ { "name" : "model_input", "type" : "obs", "data" : "$ref/data_requirements/model_input", "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/test-crq/train_output/" } } ], "outputs" : [ { "name" : "model_output", "type" : "model", "config" : { "model_id" : "253aba02-4bd6-4f64-8d37-66022ae7af4d" } } ], "properties" : { "model_name" : "lh-xh", "model_type" : "TensorFlow" }, "events" : [ "2022-06-17 17:08:17 change status from init to creating", "2022-06-17 17:08:19 change status from creating to created", "2022-06-17 17:08:20 change status from created to running", "2022-06-17 17:08:33 change status from running to completed" ], "policy" : { } }, { "created_at" : "2022-06-17T17:08:33.038184+08:00", "uuid" : "b34b2b54-eb70-4c7f-a92d-05f849d8c39a", "instance_id" : { "type" : "deploy", "service_id" : "81f22d60-5488-4e3d-bba9-08c812ae84b0", "status" : "", "update_time" : 0 }, "step_name" : "service_step", "step_title" : "service install", "status" : "completed", "duration" : 83430, "inputs" : [ { "name" : "service_input", "type" : "model_list", "data" : "$ref/data_requirements/service_model", "value" : { "model_list" : [ { "envs" : { }, "instance_count" : 1, "model_id" : "253aba02-4bd6-4f64-8d37-66022ae7af4d", "model_name" : "lh-xh", "model_version" : "0.0.62", "specification" : "modelarts.vm.ai1", "weight" : 100 } ] } } ], "outputs" : [ { "name" : "service_output", "type" : "service", "config" : { "service_id" : "81f22d60-5488-4e3d-bba9-08c812ae84b0" } } ], "properties" : { "infer_type" : "real-time", "schedule" : -1 }, "events" : [ "2022-06-17 17:08:34 change status from init to wait_inputs", "2022-06-18 16:16:58 change status from wait_inputs to creating", "2022-06-18 16:17:01 change status from creating to created", "2022-06-18 16:17:02 change status from created to running", "2022-06-18 16:19:03 change status from running to completed" ], "policy" : { } } ], "duration" : 11852428, "events" : [ "2022-06-17 17:08:17 step model_step change status from init to creating", "2022-06-17 17:08:19 step model_step change status from creating to created", "2022-06-17 17:08:20 step model_step change status from created to running", "2022-06-17 17:08:33 step model_step change status from running to completed", "2022-06-17 17:08:34 step service_step change status from init to wait_inputs", "2022-06-18 16:16:58 step service_step change status from wait_inputs to creating", "2022-06-18 16:17:01 step service_step change status from creating to created", "2022-06-18 16:17:02 step service_step change status from created to running", "2022-06-18 16:19:03 step service_step change status from running to completed" ], "data_requirements" : [ { "name" : "model_input", "type" : "obs", "conditions" : [ { "attribute" : "object_type", "operator" : "equal", "value" : "directory" } ], "value" : { "object_type" : [ "DIRECTORY" ], "obs_url" : "/test-crq/train_output/" }, "used_steps" : [ "model_step" ] }, { "name" : "service_model", "type" : "model_list", "delay" : true, "conditions" : [ { "attribute" : "model_name", "operator" : "equal", "value" : "lh-xh" } ], "value" : { "model_list" : [ { "envs" : { }, "instance_count" : 1, "model_id" : "253aba02-4bd6-4f64-8d37-66022ae7af4d", "model_name" : "lh-xh", "model_version" : "0.0.62", "specification" : "modelarts.vm.ai1", "weight" : 100 } ] }, "used_steps" : [ "service_step" ] } ], "parameters" : [ { "name" : "schedule_d5sm", "type" : "int", "format" : "schedule", "description" : "Set how long the deployed service will stop in hours, where -1 means the service will always run", "delay" : true, "value" : -1, "used_steps" : [ "service_step" ] } ], "policies" : { } } ] }
  • URI GET /v2/{project_id}/workflows/{workflow_id}/executions 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 用户项目ID。获取方法请参见获取项目ID和名称。 workflow_id 是 String 工作流的ID。 表2 Query参数 参数 是否必选 参数类型 描述 workspace_id 否 String 工作空间ID,用于过滤具体工作空间下的条目。 limit 否 String 分页参数limit,表示单次查询的条目数上限。假如要查询20~29条记录,offset为20,limit为10。 sort_by 否 String 排序依据字段,例如sort_by=create_time,则表示以条目的创建时间进行排序。 offset 否 String 分页参数offset,表示单次查询的条目偏移数量。假如要查询20~29条记录,offset为20,limit为10。 labels 否 String 执行记录标签。 status 否 String 执行记录状态。 scene_id 否 String 场景ID。 order 否 String 排序的方式。该字段必须与sort_by同时使用。 缺省值: desc 枚举值: asc:表示升序排列, desc:降序排列。
  • 响应示例 状态码: 200 OK { "description" : "api-test", "feature" : "NOTEBOOK", "flavor" : "modelarts.vm.cpu.2u", "id" : "f9937afa-4451-42db-a76b-72d624749f66", "image" : { "description" : "description", "id" : "e1a07296-22a8-4f05-8bc8-e936c8e54090", "name" : "notebook2.0-mul-kernel-cpu-cp36", "swr_path" : "swr.xxxxx.com/atelier/notebook2.0-mul-kernel-cpu-cp36:3.3.2-release_v1", "tag" : "3.3.2-release_v1", "type" : "BUILD_IN" }, "lease" : { "create_at" : 1638841744515, "duration" : 6327212, "enable" : true, "type" : "TIMING", "update_at" : 1638844471727 }, "name" : "notebooks_test", "status" : "STARTING", "token" : "5cc60e8b-8772-7690-efd6-a5874ca387c0", "url" : "https://authoring-modelarts-xxxxx.xxxxx.com/f9937afa-4451-42db-a76b-72d624749f66/lab", "volume" : { "category" : "EFS", "ownership" : "MANAGED", "mount_path" : "/home/ma-user/work/", "capacity" : 50 }, "workspace_id" : "0" }
  • URI POST /v1/{project_id}/notebooks/{id}/start 表1 路径参数 参数 是否必选 参数类型 描述 id 是 String Notebook实例ID。 project_id 是 String 用户项目ID,获取方法请参见获取项目ID和名称。 表2 Query参数 参数 是否必选 参数类型 描述 duration 否 Long 启动后运行时长(单位:毫秒)。 type 否 String 自动停止类别,默认为timing。
  • 请求参数 表2 请求Body参数 参数 是否必选 参数类型 描述 created_at 否 String 创建时间。 subscription_id 否 String 订阅ID,唯一性标识。创建订阅时,后台自动生成。 topic_urns 是 Array of strings 订阅的主题。 entity 否 String 订阅的主体。 events 否 Array of strings 订阅的事件。
  • 请求示例 创建消息订阅。设置订阅的主题为“fengbin26”,订阅的主体为“238947895793875835893490”,订阅的事件为“[ "*:failed,completed", "job_step:stop" ]”。订阅Workflow失败、完成和job_step节点停止三个事件,发生这三个事件时,会有消息提醒。 POST https://{endpoint}/v2/{project_id}/workflows/{workflow_id}/subscriptions { "topic_urns" : [ "fengbin26" ], "entity" : "238947895793875835893490", "events" : [ "*:failed,completed", "job_step:stop" ] }