Skip to content

Commit 14e4caf

Browse files
authored
Merge pull request #23 from Elliotkim2/main
Adds throughput test for taskvine
2 parents fa36df5 + 9056068 commit 14e4caf

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

test-vine-task-throughput.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env python
2+
3+
import ndcctools.taskvine as vine
4+
import time
5+
6+
if __name__ == "__main__":
7+
8+
q = vine.Manager()
9+
print("listening on port", q.port)
10+
factory = vine.Factory("local",manager_host_port="localhost:{}".format(q.port))
11+
factory.max_workers=1
12+
factory.min_workers=1
13+
factory.disk = 100
14+
15+
num_tasks = 1000
16+
17+
with factory:
18+
for i in range(num_tasks):
19+
t = vine.Task(command=":")
20+
task_id = q.submit(t)
21+
22+
print("waiting for tasks to complete...")
23+
24+
start_timer = True
25+
while not q.empty():
26+
27+
t = q.wait(5)
28+
if start_timer:
29+
start = time.time()
30+
start_timer = False
31+
32+
end = time.time()
33+
e = end-start
34+
print(f"It took {e} seconds\n")
35+
print(f"Throughput was {num_tasks/e} tasks per second")
36+
print("all tasks complete!")
37+
38+
# vim: set sts=4 sw=4 ts=4 expandtab ft=python:
39+

test-vine-task-throughput.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Install conda development environment
4+
. ./install-conda-devel.sh
5+
6+
# Install conda development environment
7+
. ./install-github.sh
8+
9+
# Run the serverless test case.
10+
python3 test-vine-task-throughput.py

0 commit comments

Comments
 (0)