Skip to content

Commit 3dece7f

Browse files
committed
lint
1 parent d1ef425 commit 3dece7f

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

test-vine-task-throughput.py

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
import ndcctools.taskvine as vine
44
import time
5-
import sys
5+
66

77
def func():
8-
return
8+
return
9+
910

1011
def main():
1112

1213
q = vine.Manager()
1314
print("Creating Library from functions...")
14-
function_lib = q.create_library_from_functions('test-library', func, add_env=False)
15+
function_lib = q.create_library_from_functions("test-library", func, add_env=False)
1516
q.install_library(function_lib)
1617

1718
print("listening on port", q.port)
18-
factory = vine.Factory("local",manager_host_port="localhost:{}".format(q.port))
19-
factory.max_workers=1
20-
factory.min_workers=1
19+
factory = vine.Factory("local", manager_host_port="localhost:{}".format(q.port))
20+
factory.max_workers = 1
21+
factory.min_workers = 1
2122

2223
num_tasks = 1000
2324

@@ -27,20 +28,20 @@ def main():
2728
task_id = q.submit(t)
2829

2930
print("waiting for tasks to complete...")
30-
31+
3132
start_timer = True
3233
while not q.empty():
3334

3435
t = q.wait(5)
3536
if start_timer:
3637
start = time.time()
3738
start_timer = False
38-
39+
3940
end = time.time()
4041
many = end - start
4142

4243
start = time.time()
43-
44+
4445
for i in range(num_tasks):
4546
while not q.empty():
4647
result = q.wait(5)
@@ -50,11 +51,11 @@ def main():
5051
print("waiting for tasks to complete...")
5152
end = time.time()
5253
one = end - start
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')
54+
throughput = num_tasks / many
55+
chaining = num_tasks / one
56+
# serverless tasks
57+
for i in range(num_tasks):
58+
t = vine.FunctionCall("test-library", "func")
5859
task_id = q.submit(t)
5960

6061
print("Waiting for tasks to complete...")
@@ -70,24 +71,20 @@ def main():
7071
start = time.time()
7172
for i in range(num_tasks):
7273
while not q.empty():
73-
result = q.wait(5)
74-
t = vine.FunctionCall('test-library', 'func')
75-
task_id = q.submit(t)
74+
q.wait(5)
75+
t = vine.FunctionCall("test-library", "func")
76+
q.submit(t)
7677
end = time.time()
77-
serverless_one = end-start
78-
serverless_throughput = num_tasks/serverless_many
79-
serverless_chaining = num_tasks/serverless_one
78+
serverless_one = end - start
79+
serverless_throughput = num_tasks / serverless_many
80+
serverless_chaining = num_tasks / serverless_one
8081

81-
8282
print(f"\nThroughput was {throughput} tasks per second")
8383
print(f"Chaining was {chaining} tasks per second")
8484
print(f"Serverless Throughput was {serverless_throughput} tasks per second")
8585
print(f"Serverless Chaining was {serverless_chaining} tasks per second")
8686
print("all tasks complete!")
8787

8888

89-
if __name__ == '__main__':
89+
if __name__ == "__main__":
9090
main()
91-
92-
# vim: set sts=4 sw=4 ts=4 expandtab ft=python:
93-

0 commit comments

Comments
 (0)