1- simple_demo :
2- name : " Simple Demo"
3- description : " A simple demo function"
4- language : " java"
5- runtime : " java11"
6- handler : " test.functions.Simple"
7- memory : 256
8- timeout : 30
9- prepare_data : []
10- prepare_scripts : []
11- fns :
12- simple :
13- args : {}
14-
15- # img_resize:
16- # resize:
17- # prepare_data: "image_${reqid}.jpg"
18- # prepare_script: |
19- # from PIL import Image, ImageDraw
20- # import random
21-
22- # def generate_random_image(width, height, output_path):
23- # # 创建一个空白图像
24- # image = Image.new('RGB', (width, height), 'white')
25- # draw = ImageDraw.Draw(image)
26-
27- # # 生成随机颜色的像素
28- # for x in range(width):
29- # for y in range(height):
30- # r = random.randint(0, 255)
31- # g = random.randint(0, 255)
32- # b = random.randint(0, 255)
33- # draw.point((x, y), fill=(r, g, b))
34-
35- # # 保存图像
36- # image.save(output_path)
37- # print(f"Image saved to {output_path}")
38-
39- # # 指定图片的宽度和高度
40- # width = 800
41- # height = 600
42- # output_path = 'random_image.png'
43-
44- # # 生成随机图片
45- # generate_random_image(width, height, output_path)
46-
47- # args:
48- # image_s3_path: "image_${reqid}.jpg"
49- # target_width: 50
50- # target_height: 50
1+ minio :
2+ endpoint : " http://192.168.31.54:9009"
3+ access_key : " minioadmin"
4+ secret_key : " minioadmin123"
5+ compose_path : " ../middlewares/minio/"
6+
7+ models :
8+ simple_demo :
9+ # name: "Simple Demo"
10+ # description: "A simple demo function"
11+ # language: "java"
12+ # runtime: "java11"
13+ # handler: "test.functions.Simple"
14+ # memory: 256
15+ # timeout: 30
16+ prepare_data : []
17+ prepare_scripts : []
18+ fns :
19+ simple :
20+ args : {}
21+
22+ img_resize :
23+ fns :
24+ resize :
25+ args :
26+ use_minio : true
27+ image_s3_path : " image_to_resize.png"
28+ target_width : 50
29+ target_height : 50
30+ prepare_data : ["image_to_resize.png"]
31+ prepare_scripts :
32+ - |
33+ from PIL import Image, ImageDraw
34+ import random
35+
36+ def generate_random_image(width, height, output_path):
37+ # 创建一个空白图像
38+ image = Image.new('RGB', (width, height), 'white')
39+ draw = ImageDraw.Draw(image)
40+
41+ # 生成随机颜色的像素
42+ for x in range(width):
43+ for y in range(height):
44+ r = random.randint(0, 255)
45+ g = random.randint(0, 255)
46+ b = random.randint(0, 255)
47+ draw.point((x, y), fill=(r, g, b))
48+
49+ # 保存图像
50+ image.save(output_path)
51+ print(f"Image saved to {output_path}")
52+
53+ # 指定图片的宽度和高度
54+ width = 800
55+ height = 600
56+ output_path = 'image_to_resize.png'
57+
58+ # 生成随机图片
59+ generate_random_image(width, height, output_path)
60+
61+ word_count :
62+ prepare_data :
63+ - large_text_file.txt
64+ prepare_scripts :
65+ - |
66+ import os
67+
68+ def generate_paragraph():
69+ paragraph = """
70+ In a far-off land, nestled among the mountains, lies a small village known for its unique culture and friendly inhabitants. Each spring, the villagers hold a grand festival to celebrate the arrival of the flowering season. Visitors from all corners gather to enjoy this beautiful moment. During the festival, people don traditional attire and dance joyfully, filling the village with laughter and cheer.
71+ """
72+ return paragraph
73+
74+ def generate_large_text_file(file_path, target_size_gb):
75+ target_size_bytes = target_size_gb * 1024 * 1024 * 1024
76+ paragraph = generate_paragraph()
77+ paragraph_length = len(paragraph.encode('utf-8'))
78+
79+ with open(file_path, 'w') as file:
80+ while os.path.getsize(file_path) < target_size_bytes:
81+ file.write(paragraph)
82+
83+ final_size = os.path.getsize(file_path) / (1024 * 1024 * 1024)
84+ print(f"Generated file size: {final_size:.2f} GB")
85+
86+ # 生成一个 1 GB 大小的文件
87+ file_path = 'large_text_file.txt'
88+ target_size_gb = 1
89+ generate_large_text_file(file_path, target_size_gb)
90+ fns :
91+ count :
92+ args :
93+ text_s3_path : " large_text_file.txt"
94+
95+ # 函数配置项变体
96+ replicas : {}
97+ benchlist : {}
98+ # img_resize2: # 函数 和 是否使用minio排列组合,每种两个
99+ # source: img_resize
100+
101+ # img_resize3:
102+ # source: img_resize
103+ # args:
104+ # use_minio: false
105+ # img_resize4:
106+ # source: img_resize
107+ # args:
108+ # use_minio: false
109+
110+
111+
112+ # benchlist:
113+ # img_resize:
114+ # img_resize2:
115+ # img_resize3:
116+ # img_resize4:
117+
51118
52119# parallel_composition:
53120# parallel:
@@ -58,35 +125,7 @@ simple_demo:
58125# args:
59126# loopTime: 10000000
60127
61- # word_count:
62- # prepare_data:
63- # - large_text_file.txt
64- # prepare_scripts:
65- # - |
66- # import os
67-
68- # def generate_paragraph():
69- # paragraph = """
70- # In a far-off land, nestled among the mountains, lies a small village known for its unique culture and friendly inhabitants. Each spring, the villagers hold a grand festival to celebrate the arrival of the flowering season. Visitors from all corners gather to enjoy this beautiful moment. During the festival, people don traditional attire and dance joyfully, filling the village with laughter and cheer.
71- # """
72- # return paragraph
73-
74- # def generate_large_text_file(file_path, target_size_gb):
75- # target_size_bytes = target_size_gb * 1024 * 1024 * 1024
76- # paragraph = generate_paragraph()
77- # paragraph_length = len(paragraph.encode('utf-8'))
78-
79- # with open(file_path, 'w') as file:
80- # while os.path.getsize(file_path) < target_size_bytes:
81- # file.write(paragraph)
82-
83- # final_size = os.path.getsize(file_path) / (1024 * 1024 * 1024)
84- # print(f"Generated file size: {final_size:.2f} GB")
85-
86- # # 生成一个 1 GB 大小的文件
87- # file_path = 'large_text_file.txt'
88- # target_size_gb = 1
89- # generate_large_text_file(file_path, target_size_gb)
128+
90129
91130# fns:
92131# split:
0 commit comments