Skip to content

Commit 67632b4

Browse files
author
Elliot Kim
committed
combines serverless to one file and adds different error messages
1 parent 30fbb7b commit 67632b4

File tree

3 files changed

+43
-62
lines changed

3 files changed

+43
-62
lines changed

test-vine-task-serverless.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

test-vine-task-throughput.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
import time
55
import sys
66

7+
def func():
8+
return
9+
710
def main():
811

912
q = vine.Manager()
13+
print("Creating Library from functions...")
14+
function_lib = q.create_library_from_functions('test-library', func, add_env=False)
15+
q.install_library(function_lib)
16+
1017
print("listening on port", q.port)
1118
factory = vine.Factory("local",manager_host_port="localhost:{}".format(q.port))
1219
factory.max_workers=1
@@ -43,14 +50,45 @@ def main():
4350
print("waiting for tasks to complete...")
4451
end = time.time()
4552
one = end - start
46-
throughput = num_tasks/many
47-
chaining = num_tasks/one
53+
throughput = num_tasks/many
54+
chaining = num_tasks/one
55+
#serverless tasks
56+
for i in range (num_tasks):
57+
t = vine.FunctionCall('test-library', 'func')
58+
task_id = q.submit(t)
59+
60+
print("Waiting for tasks to complete...")
61+
start_timer = True
62+
while not q.empty():
63+
t = q.wait(5)
64+
if start_timer:
65+
start = time.time()
66+
start_timer = False
67+
end = time.time()
68+
serverless_many = end - start
69+
70+
start = time.time()
71+
for i in range(num_tasks):
72+
while not q.empty():
73+
result = q.wait(5)
74+
t = vine.FunctionCall('test-library', 'func')
75+
task_id = q.submit(t)
76+
end = time.time()
77+
serverless_one = end-start
78+
serverless_throughput = num_tasks/serverless_many
79+
serverless_chaining = num_tasks/serverless_one
80+
81+
4882
print(f"\nThroughput was {throughput} tasks per second")
4983
print(f"Chaining was {chaining} tasks per second")
84+
print(f"\nServerless Throughput was {serverless_throughput} tasks per second")
85+
print(f"Serverless Chaining was {serverless_chaining} tasks per second")
5086
print("all tasks complete!")
51-
assert throughput >= 190
52-
assert chaining >= 155
53-
87+
assert throughput >= 190, "Throughput in python api is less than required 190"
88+
assert chaining >= 155, "Throughput for chaining in python api is less than required 155"
89+
assert serverless_throughput >= 110, "Throughput using serverless is less than required 190"
90+
assert serverless_chaining >= 50, "Throughput for chaining using serverless is less than required 155"
91+
5492
if __name__ == '__main__':
5593
main()
5694

test-vine-task-throughput.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
. ./install-github.sh
88

99
# Run the test case.
10-
python test-vine-task-serverless.py
1110
python test-vine-task-throughput.py

0 commit comments

Comments
 (0)