Skip to content

Commit

Permalink
fixes errors and adds assert to pass or fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliot Kim committed Dec 2, 2024
1 parent a5a3911 commit 5cd6fd1
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 32 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
uses: actions/checkout@v3
- name: Test Vine Serverless Mode
run: ./test-vine-serverless.sh

parrot-cvmfs-job:
runs-on: ubuntu-20.04
timeout-minutes: 10
Expand All @@ -104,6 +104,15 @@ jobs:
uses: actions/checkout@v3
- name: Test Vine Throughput
run: ./test-vine-task-throughput.sh

vine-throughput-capi-job:
runs-on: ubuntu-20.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test Vine Throughput Test C API
run: ./test-vine-task-throughput-capi.sh
# Removed plain coffea test 7/24/2023 to replace with coffea-dask-taskvine when ready.
# coffea-job:
# runs-on: ubuntu-20.04
Expand Down
17 changes: 10 additions & 7 deletions test-vine-task-chaining.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <errno.h>
#include <unistd.h>
#include <time.h>

#include <assert.h>
int main(int argc, char *argv[])
{
struct vine_manager *m;
Expand All @@ -23,11 +23,15 @@ int main(int argc, char *argv[])
printf("TaskVine listening on %d\n", vine_port(m));

printf("Declaring tasks...");

bool start_timer = true;
clock_t start = 0;
for(i=0;i<tasksC;i++) {
struct vine_task *t = vine_task_create(":");
vine_task_set_cores(t, 1);
clock_t start = clock();
if (start_timer){
start = clock();
start_timer = false;
}
int task_id = vine_submit(m, t);
while(!vine_empty(m)) {
t = vine_wait(m, 5);
Expand All @@ -39,11 +43,10 @@ int main(int argc, char *argv[])
clock_t end = clock();
double time = ((double)(end - start)) / CLOCKS_PER_SEC;
double throughput = tasksC / time;
printf("all tasks complete!\n");
printf("Time was %f seconds\n", time);
printf("Throughput was %f tasks per second\n", throughput);

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

return 0;
Expand Down
10 changes: 7 additions & 3 deletions test-vine-task-severless.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ def main():
task_id = q.submit(t)
end = time.time()
one = end-start
print(f"It took {many} seconds\n")
print(f"Throughput was {num_tasks/many} tasks per second")
print(f"Chaining was {num_tasks/one} tasks per second")
throughput = num_tasks/many
chaining = num_tasks/one

print(f"Throughput was {throughput} tasks per second")
print(f"Chaining was {chaining} tasks per second")
print("all tasks complete!")
assert throughput >= 110
assert chaining >= 50

if __name__ == '__main__':
main()
36 changes: 20 additions & 16 deletions test-vine-task-throughput.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,48 @@
#include <errno.h>
#include <unistd.h>
#include <time.h>

#include <assert.h>
int main(int argc, char *argv[])
{
struct vine_manager *m;
struct vine_task *t;
int i;
int tasksC = 5000;

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

for(i=0;i<tasksC;i++) {
struct vine_task *t = vine_task_create(":");
vine_task_set_cores(t, 1);

int task_id = vine_submit(m, t);
}

printf("waiting for tasks to complete...\n");
clock_t start = clock();
}
bool start_timer = true;
clock_t start = 0;
while(!vine_empty(m)) {
t = vine_wait(m, 5);
if(t) {
vine_task_delete(t);
struct vine_task *t = vine_wait(m, 5);
if (start_timer){
start = clock();
start_timer = false;
}
}
if(t) {
vine_task_delete(t);
}
}
clock_t end = clock();
double time = ((double)(end - start)) / CLOCKS_PER_SEC;
double throughput = tasksC / time;
printf("all tasks complete!\n");
printf("Time was %f seconds\n", time);
double throughtput_time = ((double)(end - start)) / CLOCKS_PER_SEC;

double throughput = tasksC / throughtput_time;

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

return 0;
Expand Down
10 changes: 6 additions & 4 deletions test-vine-task-throughput.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@
print("waiting for tasks to complete...")
end = time.time()
one = end - start

print(f"It took {many} seconds\n")
print(f"Throughput was {num_tasks/many} tasks per second")
print(f"Chaining was {num_tasks/one} tasks per second")
throughput = num_tasks/many
chaining = num_tasks/one
print(f"Throughput was {throughput} tasks per second")
print(f"Chaining was {chaining} tasks per second")
print("all tasks complete!")
assert throughput >= 190
assert chaining >= 155

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

2 changes: 1 addition & 1 deletion test-vine-task-throughput.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ source ./install-github.sh
conda create -yq --prefix ${CONDA_ENV} -c conda-forge --strict-channel-priority ndcctools dask
conda activate ${CONDA_ENV}

# Run the serverless test case.
# Run the test case.
python3 test-vine-task-throughput.py
python3 test-vine-task-serverless.py

0 comments on commit 5cd6fd1

Please sign in to comment.