Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/e2e/scaling/s_149.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resources:
cpu: 8
customContainerConfig:
image: >-
registry.cn-shanghai.aliyuncs.com/serverless_devs/custom-container-http-examples:springboot
registry.cn-hangzhou.aliyuncs.com/serverless_devs/custom-container-http-examples:springboot
port: 9000
instanceConcurrency: 20
memorySize: 65536
Expand Down
29 changes: 18 additions & 11 deletions __tests__/e2e/scaling/scalingConfig_provisionConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ def deploy_function(scalingConfig, provisionConfig, gpuConfig=None, memorySize=N
s_yaml = yaml.safe_load(f)

s_yaml["resources"]["fcDemo"]["props"]["scalingConfig"] = scalingConfig
s_yaml["resources"]["fcDemo"]["props"]["provisionConfig"] = provisionConfig
if gpuConfig:
if provisionConfig is not None:
s_yaml["resources"]["fcDemo"]["props"]["provisionConfig"] = provisionConfig
elif "provisionConfig" in s_yaml["resources"]["fcDemo"]["props"]:
del s_yaml["resources"]["fcDemo"]["props"]["provisionConfig"]

if gpuConfig is not None:
s_yaml["resources"]["fcDemo"]["props"]["gpuConfig"] = gpuConfig

if memorySize:
if memorySize is not None:
s_yaml["resources"]["fcDemo"]["props"]["memorySize"] = memorySize

with open(s_yaml_file, "w", encoding="utf-8") as f:
Expand Down Expand Up @@ -58,30 +62,30 @@ def main():
scalingConfig = {
"minInstances": 1,
}
provisionConfig = {}
provisionConfig = None
deploy_function(scalingConfig, provisionConfig)

# 弹性 ----> 常驻
scalingConfig = {
"residentPoolId": "fc-pool-5f044a31f87171jkwaraws",
"maxInstances": 1,
}
provisionConfig = {}
provisionConfig = None
deploy_function(scalingConfig, provisionConfig)

# 常驻 ----> 常驻
scalingConfig = {
"residentPoolId": "fc-pool-16bedd56db9626uva1it08",
"maxInstances": 1,
}
provisionConfig = {}
provisionConfig = None
deploy_function(scalingConfig, provisionConfig)

# 常驻 ----> 弹性
scalingConfig = {
"minInstances": 1,
}
provisionConfig = {}
provisionConfig = None
deploy_function(scalingConfig, provisionConfig)

cleanup_deployment()
Expand All @@ -95,7 +99,7 @@ def main():
"gpuType": "fc.gpu.tesla.1",
"gpuMemorySize": 1,
}
provisionConfig = {}
provisionConfig = None
memorySize = 32768
deploy_function(scalingConfig, provisionConfig, gpuConfig, memorySize)

Expand All @@ -108,7 +112,7 @@ def main():
"gpuType": "fc.gpu.ada.1",
"gpuMemorySize": 1,
}
provisionConfig = {}
provisionConfig = None
memorySize = 65536
deploy_function(scalingConfig, provisionConfig, gpuConfig, memorySize)

Expand All @@ -121,7 +125,7 @@ def main():
"gpuType": "fc.gpu.ada.2",
"gpuMemorySize": 1,
}
provisionConfig = {}
provisionConfig = None
memorySize = 32768
deploy_function(scalingConfig, provisionConfig, gpuConfig, memorySize)

Expand All @@ -133,8 +137,11 @@ def main():
"gpuType": "fc.gpu.tesla.1",
"gpuMemorySize": 1,
}
provisionConfig = {}
provisionConfig = None
memorySize = 32768
deploy_function(scalingConfig, provisionConfig, gpuConfig, memorySize)

cleanup_deployment()

if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Component
Name: fc3
Provider:
- 阿里云
Version: 0.1.7
Version: 0.1.8
Description: 阿里云函数计算全生命周期管理
HomePage: https://github.com/devsapp/fc3
Organization: 阿里云函数计算(FC)
Expand Down
4 changes: 2 additions & 2 deletions src/resources/fc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ export default class FC extends FC_Client {
*/
const { project, logstore } = (config.logConfig || {}) as ILogConfig;
const retrySls = slsAuto && isSlsNotExistException(project, logstore, ex);
const localGPUType = config.gpuConfig?.gpuType;
const remoteGPUType = remoteConfig.gpuConfig?.gpuType;
const localGPUType = config?.gpuConfig?.gpuType;
const remoteGPUType = remoteConfig?.gpuConfig?.gpuType;
if (retrySls) {
if (calculateRetryTime(3)) {
throw ex;
Expand Down
Loading