Skip to content

Commit

Permalink
vine: track running libraries on the worker (#4047)
Browse files Browse the repository at this point in the history
* init

* delete and clean current_libraries
  • Loading branch information
JinZhou5042 authored Feb 5, 2025
1 parent 345f582 commit 8c9088e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ static void cleanup_worker(struct vine_manager *q, struct vine_worker_info *w)
}

itable_clear(w->current_tasks, 0);
itable_clear(w->current_libraries, 0);

w->finished_tasks = 0;

Expand Down Expand Up @@ -2972,6 +2973,10 @@ static vine_result_code_t commit_task_to_worker(struct vine_manager *q, struct v
/* If start_one_task_fails, this will be decremented in handle_failure below. */
t->library_task->function_slots_inuse++;
}
/* If this is a library task, bookkeep it on the worker's side */
if (t->provides_library) {
itable_insert(w->current_libraries, t->task_id, t);
}

t->hostname = xxstrdup(w->hostname);
t->addrport = xxstrdup(w->addrport);
Expand Down Expand Up @@ -3156,6 +3161,10 @@ static void reap_task_from_worker(struct vine_manager *q, struct vine_worker_inf

itable_remove(w->current_tasks, t->task_id);

if (t->provides_library) {
itable_remove(w->current_libraries, t->task_id);
}

/*
If this was a function call assigned to a library,
then decrease the count of functions assigned,
Expand Down
2 changes: 2 additions & 0 deletions taskvine/src/manager/vine_worker_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct vine_worker_info *vine_worker_create(struct link *lnk)

w->current_files = hash_table_create(0, 0);
w->current_tasks = itable_create(0);
w->current_libraries = itable_create(0);

w->start_time = timestamp_get();
w->end_time = -1;
Expand Down Expand Up @@ -69,6 +70,7 @@ void vine_worker_delete(struct vine_worker_info *w)
hash_table_clear(w->current_files, (void *)vine_file_replica_delete);
hash_table_delete(w->current_files);
itable_delete(w->current_tasks);
itable_delete(w->current_libraries);

free(w);

Expand Down
1 change: 1 addition & 0 deletions taskvine/src/manager/vine_worker_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct vine_worker_info {
/* Current files and tasks that have been transfered to this worker */
struct hash_table *current_files;
struct itable *current_tasks;
struct itable *current_libraries;

/* The number of tasks running last reported by the worker */
int dynamic_tasks_running;
Expand Down

0 comments on commit 8c9088e

Please sign in to comment.