-
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.
- Loading branch information
1 parent
6423918
commit f4de28d
Showing
9 changed files
with
218 additions
and
2 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,86 @@ | ||
/* | ||
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" | ||
|
||
// 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) | ||
{ | ||
cctools_uuid_t uuid; | ||
cctools_uuid_create(&uuid); | ||
char *id = strdup(uuid.str); | ||
struct list *l = list_create(); | ||
|
||
t->group_id = id; | ||
|
||
struct vine_task *tc = vine_task_copy(t); | ||
|
||
list_push_head(l, tc); | ||
hash_table_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) | ||
{ | ||
struct list *l; | ||
char *id; | ||
HASH_TABLE_ITERATE(q->task_group_table, id, l) | ||
{ | ||
struct vine_file *f; | ||
LIST_ITERATE(l, f) | ||
{ | ||
if (f == m->file) { | ||
struct vine_task *tc = vine_task_copy(t); | ||
list_push_tail(l, tc); | ||
return 1; | ||
} | ||
} | ||
} | ||
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); | ||
} else if (outputs_present) { | ||
vine_task_groups_create_group(q, t, output_mount); | ||
} | ||
|
||
return inputs_present || outputs_present; | ||
} |
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,12 @@ | ||
/* | ||
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); |