Skip to content

Apibm multi 03 #2607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 9, 2024
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
43 changes: 31 additions & 12 deletions framework/e2e/api_benchmark_new/runner_ci_multipro.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,28 +133,47 @@ def __init__(self, yaml_path, python):
# 邮件报警
# self.email = Alarm(storage=self.storage)

def split_list(self, lst, n):
# def split_list(self, lst, n):
# """
# 将列表均分为n份
# Args:
# lst (list): 待划分的列表
# n (int): 划分的份数
# Returns:
# res (list): 划分后的列表,其中每个元素为原列表的1/n部分
# """
# if not isinstance(lst, list) or not isinstance(n, int) or len(lst) == 0 or n <= 0:
# return []

# quotient, remainder = divmod(len(lst), n)
# res = []
# start = 0
# for i in range(n):
# if i < remainder:
# end = start + quotient + 1
# else:
# end = start + quotient
# res.append(lst[start:end])
# start = end
# return res

def split_list(lst, n):
"""
将列表均分为n份
将列表按顺序划分为 n 份
Args:
lst (list): 待划分的列表
n (int): 划分的份数
Returns:
res (list): 划分后的列表,其中每个元素为原列表的1/n部分
res (list): 划分后的列表,其中每个元素为原列表的 1/n 部分
"""
if not isinstance(lst, list) or not isinstance(n, int) or len(lst) == 0 or n <= 0:
return []

quotient, remainder = divmod(len(lst), n)
res = []
start = 0
for i in range(n):
if i < remainder:
end = start + quotient + 1
else:
end = start + quotient
res.append(lst[start:end])
start = end
res = [[] for _ in range(n)]
for i, value in enumerate(lst):
index = i % n
res[index].append(value)
return res

def _multi_run_main(self, all_cases, loops, base_times, result_queue):
Expand Down
Loading