Skip to content

Commit d949bb3

Browse files
committed
fix error issue due to version upgrade
Signed-off-by: seven <[email protected]>
1 parent 621a1cf commit d949bb3

File tree

6 files changed

+83
-25
lines changed

6 files changed

+83
-25
lines changed

package-lock.json

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@alicloud/ros-cdk-ram": "^1.6.0",
6464
"@alicloud/ros-cdk-rds": "^1.6.0",
6565
"@alicloud/ros-cdk-sls": "^1.6.0",
66+
"@alicloud/ros-cdk-vpc": "^1.7.0",
6667
"@alicloud/ros20190910": "^3.5.3",
6768
"ajv": "^8.17.1",
6869
"ali-oss": "^6.22.0",

samples/aliyun-poc-fc-gpu.yml

+23-22
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@ provider:
33
name: aliyun
44
region: cn-hangzhou
55

6-
vars:
7-
testv: testVarValue
8-
handler: index.handler
9-
10-
stages:
11-
default:
12-
node_env: default
13-
dev:
14-
node_env: development
15-
prod:
16-
region: cn-hangzhou
176

187
service: insight-poc-gpu
198

@@ -24,17 +13,18 @@ functions:
2413
insight_poc_fn:
2514
name: insight-poc-gpu-fn
2615
container:
27-
image: registry.cn-chengdu.aliyuncs.com/geek-fun/meke-api:latest
28-
cmd: "npm start"
16+
image: registry.cn-hangzhou.aliyuncs.com/serverless_devs/modelscope:ubuntu20.04-cuda11.3.0-py37-torch1.11.0-tf1.15.5-1.5.0
17+
cmd: "ollama run modelscope.cn/DeepSeek-R1-Distill-Qwen-1.5B-GGUF"
2918
port: 9000
30-
memory: 512
31-
gpu: TESLA_8
32-
timeout: 10
19+
memory: 4096
20+
gpu: TESLA_16
21+
timeout: 900
22+
log: true
3323
network:
34-
vpc_id: vpc-2vc8v9btc8470laqui9bk
24+
vpc_id: vpc-bp1jpzq0807mrww7i8uko
3525
subnet_ids:
36-
- vsw-2vc9zrs5mojkxd14yo3zw
37-
- vsw-2vceshdo0xjp9q9t0oyt0
26+
- vsw-bp1tp32pxn8c3mm07e9s2
27+
- vsw-bp1gs2ggjq85apbf5yd9d
3828
security_group:
3929
name: insight-poc-gpu-fn-sg
4030
ingress:
@@ -49,6 +39,17 @@ functions:
4939
- mount_path: /mnt/nas
5040
storage_class: STANDARD_CAPACITY
5141
environment:
52-
NODE_ENV: ${stages.node_env}
53-
TEST_VAR: ${vars.testv}
54-
TEST_VAR_EXTRA: abcds-${vars.testv}-andyou
42+
OLLAMA_MODELS: /mnt/nas/models
43+
LLAMA_GPU_OVERHEAD: 0
44+
OLLAMA_HOST: http://0.0.0.0:11434
45+
OLLAMA_INTEL_GPU: false
46+
OLLAMA_KEEP_ALIVE: 2562047h47m16.854775807s
47+
OLLAMA_LOAD_TIMEOUT: 5m0s
48+
OLLAMA_MAX_LOADED_MODELS: 1
49+
OLLAMA_MAX_QUEUE: 1
50+
OLLAMA_MULTIUSER_CACHE: false
51+
OLLAMA_NOHISTORY: false
52+
OLLAMA_NOPRUNE: false
53+
OLLAMA_NUM_PARALLEL: 1
54+
OLLAMA_ORIGINS: [ * http://localhost https://localhost http://localhost:* https://localhost:* http://127.0.0.1 https://127.0.0.1 http://127.0.0.1:* https://127.0.0.1:* http://0.0.0.0 https://0.0.0.0 http://0.0.0.0:* https://0.0.0.0:* app://* file://* tauri://* vscode-webview://* ]
55+
OLLAMA_SCHED_SPREAD: fals

src/common/rosClient.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ const updateStack = async (stackId: string, templateBody: unknown, context: Acti
6969
// wait for stack update complete
7070
return await getStackActionResult(response.body?.stackId || '', context.region);
7171
} catch (err) {
72-
const { Message: message, statusCode } =
73-
(err as { data: { Message: string; statusCode: number } })?.data || {};
72+
const { message, statusCode } =
73+
(err as {
74+
message: string;
75+
code: string;
76+
statusCode: number;
77+
description: string;
78+
requestId: string;
79+
accessDeniedDetail: unknown;
80+
}) || {};
7481
if (statusCode === 400 && message.includes('Update the completely same stack')) {
7582
logger.warn(`${lang.__('UPDATE_COMPLETELY_SAME_STACK')}`);
7683
return null;

src/stack/rosStack/function.ts

+25
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import * as ros from '@alicloud/ros-cdk-core';
2121
import * as sls from '@alicloud/ros-cdk-sls';
2222
import * as nas from '@alicloud/ros-cdk-nas';
2323
import * as ecs from '@alicloud/ros-cdk-ecs';
24+
import * as vpc from '@alicloud/ros-cdk-vpc';
2425
import { RosFunction, RosFunctionProps } from '@alicloud/ros-cdk-fc3/lib/fc3.generated';
2526

2627
const storageClassMap = {
@@ -237,6 +238,30 @@ export const resolveFunctions = (
237238
true,
238239
);
239240

241+
const fcVpcSubnets = fnc.network?.subnet_ids.map(
242+
(subnet) =>
243+
new vpc.datasource.VSwitch(
244+
scope,
245+
`${fnc.key}_datasource_subnet_${encodeBase64ForRosId(subnet)}`,
246+
{
247+
vSwitchId: subnet,
248+
refreshOptions: 'Always',
249+
},
250+
),
251+
);
252+
253+
fcVpcSubnets?.forEach((subnetDatasource, index) => {
254+
new nas.AccessRule(
255+
scope,
256+
`${fnc.key}_nas_rule_${encodeBase64ForRosId(fnc.network!.subnet_ids[index])}`,
257+
{
258+
accessGroupName: accessGroup.attrAccessGroupName,
259+
sourceCidrIp: subnetDatasource.attrCidrBlock,
260+
},
261+
true,
262+
);
263+
});
264+
240265
const nasResource = new nas.FileSystem(
241266
scope,
242267
`${fnc.key}_nas_${encodeBase64ForRosId(nasItem.mount_path)}`,

src/validator/functionSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export const functionSchema = {
9898
storage_class: {
9999
type: 'string',
100100
enum: [
101-
'STANDARD_PERFORMANCE',
102101
'STANDARD_CAPACITY',
102+
'STANDARD_PERFORMANCE',
103103
'EXTREME_STANDARD',
104104
'EXTREME_ADVANCE',
105105
],

0 commit comments

Comments
 (0)