-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vine: fixed_location task groups (#3787)
* merge vine_task.c * unused code * add worker code * rebase * more merging * regular task issue fix * cleanup allocations * compatible with function calls * remove group reference on cancel * add tune option for task groups * format * get groupid from file recovery task * comment * merge in priority queue * worker cache ensure check queued tasks * commit task after group list removal * do not group recovery tasks * format * format after rebase * add group counter to manager * do not check refcount * change group hash table to itable * change type at worker
- Loading branch information
1 parent
c682ccb
commit 49abae3
Showing
12 changed files
with
243 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
Copyright (C) 2022- The University of Notre Dame | ||
This software is distributed under the GNU General Public License. | ||
See the file COPYING for details. | ||
*/ | ||
|
||
#include "vine_task_groups.h" | ||
#include "debug.h" | ||
#include "vine_mount.h" | ||
#include "vine_task.h" | ||
#include "stringtools.h" | ||
|
||
// create a new task group for this task based on the temp mount file | ||
static int vine_task_groups_create_group(struct vine_manager *q, struct vine_task *t, struct vine_mount *m) | ||
{ | ||
int id = q->group_id_counter++; | ||
struct list *l = list_create(); | ||
|
||
t->group_id = id; | ||
|
||
struct vine_task *tc = vine_task_addref(t); | ||
|
||
list_push_head(l, tc); | ||
itable_insert(q->task_group_table, id, l); | ||
return 1; | ||
} | ||
|
||
// locate the group with the task which outputs the desired file, and add the new task | ||
static int vine_task_groups_add_to_group(struct vine_manager *q, struct vine_task *t, struct vine_mount *m) | ||
{ | ||
int id = m->file->recovery_task->group_id; | ||
|
||
if (id) { | ||
struct list *group = itable_lookup(q->task_group_table, id); | ||
t->group_id = id; | ||
struct vine_task *tc = vine_task_addref(t); | ||
list_push_tail(group, tc); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/* | ||
When a task comes in through vine_submit, look for temp files in its inputs/outputs | ||
If there is a temp file on the input there is already a task group it should be assigned to. | ||
If there is only a temp output it would be the first of a new group. | ||
*/ | ||
int vine_task_groups_assign_task(struct vine_manager *q, struct vine_task *t) | ||
{ | ||
struct vine_mount *input_mount; | ||
struct vine_mount *output_mount; | ||
|
||
int inputs_present = 0; | ||
int outputs_present = 0; | ||
|
||
LIST_ITERATE(t->input_mounts, input_mount) | ||
{ | ||
if (input_mount->file->type == VINE_TEMP) { | ||
inputs_present++; | ||
break; | ||
} | ||
} | ||
|
||
LIST_ITERATE(t->output_mounts, output_mount) | ||
{ | ||
if (output_mount->file->type == VINE_TEMP) { | ||
outputs_present++; | ||
break; | ||
} | ||
} | ||
|
||
// could also be inputs_present && outputs_present | ||
if (inputs_present) { | ||
vine_task_groups_add_to_group(q, t, input_mount); | ||
debug(D_VINE, "Assigned task to group %d", t->group_id); | ||
} else if (outputs_present) { | ||
vine_task_groups_create_group(q, t, output_mount); | ||
debug(D_VINE, "Create task with group %d", t->group_id); | ||
} | ||
|
||
return inputs_present || outputs_present; | ||
} | ||
|
||
static void vine_task_group_delete(struct list *l) | ||
{ | ||
if (l) { | ||
list_delete(l); | ||
} | ||
} | ||
|
||
void vine_task_groups_clear(struct vine_manager *q) | ||
{ | ||
itable_clear(q->task_group_table, (void *)vine_task_group_delete); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
Copyright (C) 2022- The University of Notre Dame | ||
This software is distributed under the GNU General Public License. | ||
See the file COPYING for details. | ||
*/ | ||
|
||
#include "taskvine.h" | ||
#include "vine_manager.h" | ||
#include "uuid.h" | ||
|
||
|
||
int vine_task_groups_assign_task(struct vine_manager *q, struct vine_task *t); | ||
|
||
void vine_task_groups_clear(struct vine_manager *q); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.