Skip to content

Commit 8c9088e

Browse files
authored
vine: track running libraries on the worker (#4047)
* init * delete and clean current_libraries
1 parent 345f582 commit 8c9088e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

taskvine/src/manager/vine_manager.c

+9
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ static void cleanup_worker(struct vine_manager *q, struct vine_worker_info *w)
930930
}
931931

932932
itable_clear(w->current_tasks, 0);
933+
itable_clear(w->current_libraries, 0);
933934

934935
w->finished_tasks = 0;
935936

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

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

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

3164+
if (t->provides_library) {
3165+
itable_remove(w->current_libraries, t->task_id);
3166+
}
3167+
31593168
/*
31603169
If this was a function call assigned to a library,
31613170
then decrease the count of functions assigned,

taskvine/src/manager/vine_worker_info.c

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct vine_worker_info *vine_worker_create(struct link *lnk)
3434

3535
w->current_files = hash_table_create(0, 0);
3636
w->current_tasks = itable_create(0);
37+
w->current_libraries = itable_create(0);
3738

3839
w->start_time = timestamp_get();
3940
w->end_time = -1;
@@ -69,6 +70,7 @@ void vine_worker_delete(struct vine_worker_info *w)
6970
hash_table_clear(w->current_files, (void *)vine_file_replica_delete);
7071
hash_table_delete(w->current_files);
7172
itable_delete(w->current_tasks);
73+
itable_delete(w->current_libraries);
7274

7375
free(w);
7476

taskvine/src/manager/vine_worker_info.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct vine_worker_info {
6262
/* Current files and tasks that have been transfered to this worker */
6363
struct hash_table *current_files;
6464
struct itable *current_tasks;
65+
struct itable *current_libraries;
6566

6667
/* The number of tasks running last reported by the worker */
6768
int dynamic_tasks_running;

0 commit comments

Comments
 (0)