Skip to content

Commit 5cd6fd1

Browse files
author
Elliot Kim
committed
fixes errors and adds assert to pass or fail
1 parent a5a3911 commit 5cd6fd1

File tree

6 files changed

+54
-32
lines changed

6 files changed

+54
-32
lines changed

.github/workflows/daily.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
uses: actions/checkout@v3
7878
- name: Test Vine Serverless Mode
7979
run: ./test-vine-serverless.sh
80-
80+
8181
parrot-cvmfs-job:
8282
runs-on: ubuntu-20.04
8383
timeout-minutes: 10
@@ -104,6 +104,15 @@ jobs:
104104
uses: actions/checkout@v3
105105
- name: Test Vine Throughput
106106
run: ./test-vine-task-throughput.sh
107+
108+
vine-throughput-capi-job:
109+
runs-on: ubuntu-20.04
110+
timeout-minutes: 20
111+
steps:
112+
- name: Checkout
113+
uses: actions/checkout@v3
114+
- name: Test Vine Throughput Test C API
115+
run: ./test-vine-task-throughput-capi.sh
107116
# Removed plain coffea test 7/24/2023 to replace with coffea-dask-taskvine when ready.
108117
# coffea-job:
109118
# runs-on: ubuntu-20.04

test-vine-task-chaining.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <errno.h>
77
#include <unistd.h>
88
#include <time.h>
9-
9+
#include <assert.h>
1010
int main(int argc, char *argv[])
1111
{
1212
struct vine_manager *m;
@@ -23,11 +23,15 @@ int main(int argc, char *argv[])
2323
printf("TaskVine listening on %d\n", vine_port(m));
2424

2525
printf("Declaring tasks...");
26-
26+
bool start_timer = true;
27+
clock_t start = 0;
2728
for(i=0;i<tasksC;i++) {
2829
struct vine_task *t = vine_task_create(":");
2930
vine_task_set_cores(t, 1);
30-
clock_t start = clock();
31+
if (start_timer){
32+
start = clock();
33+
start_timer = false;
34+
}
3135
int task_id = vine_submit(m, t);
3236
while(!vine_empty(m)) {
3337
t = vine_wait(m, 5);
@@ -39,11 +43,10 @@ int main(int argc, char *argv[])
3943
clock_t end = clock();
4044
double time = ((double)(end - start)) / CLOCKS_PER_SEC;
4145
double throughput = tasksC / time;
42-
printf("all tasks complete!\n");
43-
printf("Time was %f seconds\n", time);
44-
printf("Throughput was %f tasks per second\n", throughput);
4546

46-
//Free the manager structure, and release all the workers.
47+
printf("Throughput was %f tasks per second\n", throughput);
48+
printf("all tasks complete!\n");
49+
assert(throughput > 1000);
4750
vine_delete(m);
4851

4952
return 0;

test-vine-task-severless.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ def main():
4242
task_id = q.submit(t)
4343
end = time.time()
4444
one = end-start
45-
print(f"It took {many} seconds\n")
46-
print(f"Throughput was {num_tasks/many} tasks per second")
47-
print(f"Chaining was {num_tasks/one} tasks per second")
45+
throughput = num_tasks/many
46+
chaining = num_tasks/one
47+
48+
print(f"Throughput was {throughput} tasks per second")
49+
print(f"Chaining was {chaining} tasks per second")
4850
print("all tasks complete!")
51+
assert throughput >= 110
52+
assert chaining >= 50
4953

5054
if __name__ == '__main__':
5155
main()

test-vine-task-throughput.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,48 @@
66
#include <errno.h>
77
#include <unistd.h>
88
#include <time.h>
9-
9+
#include <assert.h>
1010
int main(int argc, char *argv[])
1111
{
1212
struct vine_manager *m;
13-
struct vine_task *t;
1413
int i;
1514
int tasksC = 5000;
1615

17-
//Create the manager. All tasks and files will be declared with respect to
1816
m = vine_create(VINE_DEFAULT_PORT);
17+
printf("%d", VINE_DEFAULT_PORT);
1918
if(!m) {
2019
printf("couldn't create manager: %s\n", strerror(errno));
2120
return 1;
2221
}
2322
printf("TaskVine listening on %d\n", vine_port(m));
24-
printf("Declaring tasks...");
2523

2624
for(i=0;i<tasksC;i++) {
2725
struct vine_task *t = vine_task_create(":");
2826
vine_task_set_cores(t, 1);
27+
2928
int task_id = vine_submit(m, t);
30-
}
3129

32-
printf("waiting for tasks to complete...\n");
33-
clock_t start = clock();
30+
}
31+
bool start_timer = true;
32+
clock_t start = 0;
3433
while(!vine_empty(m)) {
35-
t = vine_wait(m, 5);
36-
if(t) {
37-
vine_task_delete(t);
34+
struct vine_task *t = vine_wait(m, 5);
35+
if (start_timer){
36+
start = clock();
37+
start_timer = false;
3838
}
39-
}
39+
if(t) {
40+
vine_task_delete(t);
41+
}
42+
}
4043
clock_t end = clock();
41-
double time = ((double)(end - start)) / CLOCKS_PER_SEC;
42-
double throughput = tasksC / time;
43-
printf("all tasks complete!\n");
44-
printf("Time was %f seconds\n", time);
44+
double throughtput_time = ((double)(end - start)) / CLOCKS_PER_SEC;
45+
46+
double throughput = tasksC / throughtput_time;
47+
4548
printf("Throughput was %f tasks per second\n", throughput);
46-
//Free the manager structure, and release all the workers.
49+
printf("all tasks complete!\n");
50+
assert(throughput > 1000);
4751
vine_delete(m);
4852

4953
return 0;

test-vine-task-throughput.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@
4343
print("waiting for tasks to complete...")
4444
end = time.time()
4545
one = end - start
46-
47-
print(f"It took {many} seconds\n")
48-
print(f"Throughput was {num_tasks/many} tasks per second")
49-
print(f"Chaining was {num_tasks/one} tasks per second")
46+
throughput = num_tasks/many
47+
chaining = num_tasks/one
48+
print(f"Throughput was {throughput} tasks per second")
49+
print(f"Chaining was {chaining} tasks per second")
5050
print("all tasks complete!")
51+
assert throughput >= 190
52+
assert chaining >= 155
5153

5254
# vim: set sts=4 sw=4 ts=4 expandtab ft=python:
5355

test-vine-task-throughput.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ source ./install-github.sh
99
conda create -yq --prefix ${CONDA_ENV} -c conda-forge --strict-channel-priority ndcctools dask
1010
conda activate ${CONDA_ENV}
1111

12-
# Run the serverless test case.
12+
# Run the test case.
1313
python3 test-vine-task-throughput.py
1414
python3 test-vine-task-serverless.py

0 commit comments

Comments
 (0)