Skip to content

Commit 374450b

Browse files
committed
feat(scf): cli createfunction support sfType
1 parent e91c2ec commit 374450b

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tencent-component-toolkit",
3-
"version": "2.24.2",
3+
"version": "2.24.3",
44
"description": "Tencent component toolkit",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/modules/scf/interface.ts

+25-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface FunctionCode {
1212
RegistryId?: string;
1313
Command?: string;
1414
Args?: string;
15+
ContainerImageAccelerate?: boolean;
1516
};
1617
}
1718

@@ -67,6 +68,13 @@ export interface BaseFunctionConfig {
6768
ProtocolParams?: ProtocolParams;
6869
NodeType?: string;
6970
NodeSpec?: string;
71+
SFType?: string;
72+
GpuReservedQuota?: number;
73+
// 请求并发
74+
InstanceConcurrencyConfig?: {
75+
DynamicEnabled?: boolean;
76+
MaxConcurrency?: number;
77+
};
7078
}
7179

7280
export interface TriggerType {
@@ -228,6 +236,8 @@ export interface ScfCreateFunctionInputs {
228236
command?: string;
229237
// 启动命令参数
230238
args?: string;
239+
// 镜像加速
240+
containerImageAccelerate?: boolean;
231241
};
232242

233243
// 异步调用重试配置
@@ -236,6 +246,16 @@ export interface ScfCreateFunctionInputs {
236246

237247
protocolType?: string;
238248
protocolParams?: ProtocolParams;
249+
250+
// sd应用类型
251+
sFType?: string;
252+
// gpu并发数,默认是0
253+
gpuReservedQuota?: number;
254+
// 请求并发配置
255+
instanceConcurrencyConfig?: {
256+
dynamicEnabled?: boolean;
257+
maxConcurrency?: number;
258+
};
239259
}
240260

241261
export interface ScfUpdateAliasTrafficInputs {
@@ -391,25 +411,25 @@ export interface GetRequestStatusOptions {
391411
/**
392412
* 函数名称
393413
*/
394-
functionName: string
414+
functionName: string;
395415

396416
/**
397417
* 需要查询状态的请求id
398418
*/
399-
functionRequestId: string
419+
functionRequestId: string;
400420

401421
/**
402422
* 函数的所在的命名空间
403423
*/
404-
namespace?: string
424+
namespace?: string;
405425

406426
/**
407427
* 查询的开始时间,例如:2017-05-16 20:00:00,不填默认为当前时间 - 15min
408428
*/
409-
startTime?: string
429+
startTime?: string;
410430

411431
/**
412432
* 查询的结束时间,例如:2017-05-16 20:59:59,不填默认为当前时间。EndTime 需要晚于 StartTime。
413433
*/
414-
endTime?: string
434+
endTime?: string;
415435
}

src/modules/scf/utils.ts

+21
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
5252
if (imageConfig.args) {
5353
functionInputs.Code!.ImageConfig!.Args = imageConfig.args;
5454
}
55+
56+
if (imageConfig?.containerImageAccelerate !== undefined) {
57+
functionInputs.Code!.ImageConfig!.ContainerImageAccelerate =
58+
imageConfig?.containerImageAccelerate;
59+
}
5560
} else {
5661
// 基于 COS 代码部署
5762
functionInputs.Code = {
@@ -85,6 +90,22 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
8590
}
8691
}
8792

93+
// sd应用类型
94+
if (inputs?.sFType) {
95+
functionInputs.SFType = inputs?.sFType;
96+
}
97+
// sd gpu并发数
98+
if (inputs?.gpuReservedQuota) {
99+
functionInputs.GpuReservedQuota = inputs?.gpuReservedQuota;
100+
}
101+
// 请求并发
102+
if (inputs?.instanceConcurrencyConfig) {
103+
functionInputs.InstanceConcurrencyConfig = {
104+
DynamicEnabled: inputs?.instanceConcurrencyConfig?.dynamicEnabled,
105+
MaxConcurrency: inputs?.instanceConcurrencyConfig?.maxConcurrency,
106+
};
107+
}
108+
88109
if (inputs.role) {
89110
functionInputs.Role = inputs.role;
90111
}

0 commit comments

Comments
 (0)