From 2fedfdbf2ca52c9a786a4f559e75597f008607d7 Mon Sep 17 00:00:00 2001 From: ciryu Date: Wed, 20 Apr 2022 19:50:43 +0800 Subject: [PATCH 1/2] feat:support GPU node type --- docs/configure.md | 56 +++++++++++++++++++++------------------- serverless.component.yml | 2 +- src/interface/inputs.ts | 9 +++++++ version.yml | 2 +- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/docs/configure.md b/docs/configure.md index c569807..01e52ab 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -38,6 +38,8 @@ inputs: timeout: 10 user-detail: type: web + nodeType: CPU # 资源类型, 可选GPU/CPU + nodeSpec: "" # 资源配置, nodeType为GPU需配置 image: # 镜像配置 registryId: tcr-xxx # 容器镜像服务实例 ID,企业版必须 imageUrl: abc.com:latest@sha256:xxx # 镜像版本 URL @@ -177,32 +179,34 @@ functions: `Function` 对象支持配置属性如下: -| 参数名称 | 必选 | 类型 | 默认值 | 描述 | -| ----------------- | ---- | ----------------------------- | ------- | --------------------------------------------------------------------------------------------------------- | -| handler | 否 | string | | 处理方法名称 | -| type | 否 | string | `event` | 函数类型,支持:event、web | -| name | 否 | string | | 函数名称 | -| src | 否 | string | | 代码目录,相对于 [Src](#Src) 指定目录 | -| role | 否 | string | | 运行角色。 | -| description | 否 | string | | 描述 | -| memorySize | 否 | number | `128` | 运行内存,单位 `MB`,范围 64、128-3072,以 128 为阶梯 | -| timeout | 否 | number | `3` | 超时时间,单位为秒,可选值范围 1-900 秒 | -| environments | 否 | [Environment](#Environment)[] | | 环境变量 | -| vpc | 否 | [Vpc](#Vpc) | | 私有网络配置 | -| layers | 否 | [Layer](#Layer)[] | | 层 | -| cls | 否 | [Cls](#Cls) | | CLS 日志配置 | -| tags | 否 | [Tag](#Tag)[] | | 标签设置 | -| cfs | 否 | [Cfs](#Cfs)[] | | 文件系统挂载配置,用于云函数挂载文件系统。 | -| publicAccess | 否 | number | `true` | 是否开启公网访问 | -| eip | 否 | boolean | `false` | 固定出口 IP。默认为 false,即不启用。 | -| asyncRunEnable | 否 | boolean | `false` | 是否启用异步执行,默认最大支持 `12小时`,配置为 `true` 时,`cls` 配置必须。`此参数只有在函数创建时才有效` | -| traceEnable | 否 | boolean | `false` | 是否启用状态追踪,如果要配置为 `true`,必须配置 `asyncRunEnable` 为 `true` | -| installDependency | 否 | boolean | `false` | 是否自动在线安装依赖 | -| eip | 否 | boolean | `false` | 是否[固定出口 IP][固定出口ip] | -| image | 否 | [Image](#Image) | | 镜像配置 | -| msgTTL | 否 | number | `21600` | 消息保留时间,单位 `秒` | -| retryNum | 否 | number | `2` | 重试次数 | -| | +| 参数名称 | 必选 | 类型 | 默认值 | 描述 | +|-------------------| ---- | ----------------------------- |---------|------------------------------------------------------------------------------------------------------------------------------------| +| handler | 否 | string | | 处理方法名称 | +| type | 否 | string | `event` | 函数类型,支持:event、web | +| nodeType | 否 | string | `CPU` | 资源类型,支持:GPU、CPU,当nodeType=GPU时,必须指定image镜像配置 | +| nodeSpec | 否 | string | | GPU资源配置,支持:计算型GN7(GN7.LARGE20,GN7.2XLARGE40,GN7.5XLARGE80),渲染型GN7vw(GN7vw.LARGE16,GN7vw.2XLARGE32,GN7vw.2XLARGE32,GN7vw.4XLARGE64) | +| name | 否 | string | | 函数名称 | +| src | 否 | string | | 代码目录,相对于 [Src](#Src) 指定目录 | +| role | 否 | string | | 运行角色。 | +| description | 否 | string | | 描述 | +| memorySize | 否 | number | `128` | 运行内存,单位 `MB`,范围 64、128-3072,以 128 为阶梯 | +| timeout | 否 | number | `3` | 超时时间,单位为秒,可选值范围 1-900 秒 | +| environments | 否 | [Environment](#Environment)[] | | 环境变量 | +| vpc | 否 | [Vpc](#Vpc) | | 私有网络配置 | +| layers | 否 | [Layer](#Layer)[] | | 层 | +| cls | 否 | [Cls](#Cls) | | CLS 日志配置 | +| tags | 否 | [Tag](#Tag)[] | | 标签设置 | +| cfs | 否 | [Cfs](#Cfs)[] | | 文件系统挂载配置,用于云函数挂载文件系统。 | +| publicAccess | 否 | number | `true` | 是否开启公网访问 | +| eip | 否 | boolean | `false` | 固定出口 IP。默认为 false,即不启用。 | +| asyncRunEnable | 否 | boolean | `false` | 是否启用异步执行,默认最大支持 `12小时`,配置为 `true` 时,`cls` 配置必须。`此参数只有在函数创建时才有效` | +| traceEnable | 否 | boolean | `false` | 是否启用状态追踪,如果要配置为 `true`,必须配置 `asyncRunEnable` 为 `true` | +| installDependency | 否 | boolean | `false` | 是否自动在线安装依赖 | +| eip | 否 | boolean | `false` | 是否[固定出口 IP][固定出口ip] | +| image | 否 | [Image](#Image) | | 镜像配置 | +| msgTTL | 否 | number | `21600` | 消息保留时间,单位 `秒` | +| retryNum | 否 | number | `2` | 重试次数 | +| | **重要字段说明** diff --git a/serverless.component.yml b/serverless.component.yml index 45b5c64..1f57d37 100644 --- a/serverless.component.yml +++ b/serverless.component.yml @@ -1,5 +1,5 @@ name: multi-scf -version: 0.3.11 +version: 0.3.14 author: Tencent Cloud, Inc. org: Tencent Cloud, Inc. description: 多函数组件,允许用户开发部署多个腾讯 SCF 函数实例,适合进行多个函数开发的场景,如: 资源的增删改查功能。 diff --git a/src/interface/inputs.ts b/src/interface/inputs.ts index 3204fdb..a388247 100644 --- a/src/interface/inputs.ts +++ b/src/interface/inputs.ts @@ -24,6 +24,11 @@ export interface FaasBaseConfig { timeout?: number; // 描述 description?: string; + // 资源类型,支持'CPU'和'GPU' + nodeType?: string; + // 资源规格,仅GPU类型可配置 + nodeSpec?: string; + // 函数环境变量 environments?: KeyValue[]; // 环境变量,兼容老的结构 { variables: { [key: string]: string } } @@ -96,6 +101,10 @@ export interface FaasInputs extends FaasBaseConfig { args?: string; }; handler: string; + // 资源类型,支持'CPU'和'GPU' + nodeType?: string; + // 资源规格,仅GPU类型可配置 + nodeSpec?: string; // 镜像配置 image?: { diff --git a/version.yml b/version.yml index ad17ce9..05b0ed2 100644 --- a/version.yml +++ b/version.yml @@ -1 +1 @@ -version: 0.3.11 +version: 0.3.14 From 75fd5dfdc015e6413bb06d1b39f5cb1795fdb664 Mon Sep 17 00:00:00 2001 From: ciryu Date: Mon, 25 Apr 2022 18:40:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=EF=BC=9Atoolkit=20version=20v2.24.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index e8e7cc4..462c390 100644 --- a/src/package.json +++ b/src/package.json @@ -5,6 +5,6 @@ "adm-zip": "^0.5.5", "fast-glob": "^3.2.5", "rimraf": "^3.0.2", - "tencent-component-toolkit": "^2.23.3" + "tencent-component-toolkit": "^2.24.0" } }