@@ -24,6 +24,7 @@ See the file COPYING for details.
2424#include "vine_runtime_dir.h"
2525#include "vine_schedule.h"
2626#include "vine_task.h"
27+ #include "vine_task_groups.h"
2728#include "vine_task_info.h"
2829#include "vine_taskgraph_log.h"
2930#include "vine_txn_log.h"
@@ -2709,6 +2710,41 @@ static vine_result_code_t start_one_task(struct vine_manager *q, struct vine_wor
27092710 return result ;
27102711}
27112712
2713+ /*
2714+ Start one task on a given worker by specializing the task to the worker,
2715+ sending the appropriate input files, and then sending the details of the task.
2716+ Note that the "infile" and "outfile" components of the task refer to
2717+ files that have already been uploaded into the worker's cache by the manager.
2718+ */
2719+
2720+ static vine_result_code_t start_group_task (
2721+ struct vine_manager * q , struct vine_worker_info * w , struct vine_task * t , struct list * l )
2722+ {
2723+ vine_result_code_t result = 0 ;
2724+ struct vine_task * lt ;
2725+ LIST_ITERATE (l , lt )
2726+ {
2727+ struct rmsummary * limits = vine_manager_choose_resources_for_task (q , w , t );
2728+ char * command_line ;
2729+
2730+ if (q -> monitor_mode && !t -> needs_library ) {
2731+ command_line = vine_monitor_wrap (q , w , t , limits );
2732+ } else {
2733+ command_line = xxstrdup (t -> command_line );
2734+ }
2735+ result = vine_manager_put_task (q , w , lt , command_line , limits , 0 );
2736+ free (command_line );
2737+ if (result == VINE_SUCCESS ) {
2738+ t -> current_resource_box = limits ;
2739+ rmsummary_merge_override_basic (t -> resources_allocated , limits );
2740+ debug (D_VINE , "%s (%s) busy on group '%s'" , w -> hostname , w -> addrport , t -> command_line );
2741+ } else {
2742+ rmsummary_delete (limits );
2743+ }
2744+ }
2745+ return result ;
2746+ }
2747+
27122748static void count_worker_resources (struct vine_manager * q , struct vine_worker_info * w )
27132749{
27142750 w -> resources -> cores .inuse = 0 ;
@@ -2816,7 +2852,16 @@ static vine_result_code_t commit_task_to_worker(struct vine_manager *q, struct v
28162852 t -> addrport = xxstrdup (w -> addrport );
28172853
28182854 t -> time_when_commit_start = timestamp_get ();
2819- vine_result_code_t result = start_one_task (q , w , t );
2855+ vine_result_code_t result ;
2856+ struct list * l = 0 ;
2857+ if (t -> group_id ) {
2858+ l = hash_table_lookup (q -> task_group_table , t -> group_id );
2859+ }
2860+ if (l && list_size (l ) > 1 ) {
2861+ result = start_group_task (q , w , t , l );
2862+ } else {
2863+ result = start_one_task (q , w , t );
2864+ }
28202865 t -> time_when_commit_end = timestamp_get ();
28212866
28222867 itable_insert (w -> current_tasks , t -> task_id , t );
@@ -3779,6 +3824,7 @@ struct vine_manager *vine_ssl_create(int port, const char *key, const char *cert
37793824
37803825 q -> factory_table = hash_table_create (0 , 0 );
37813826 q -> current_transfer_table = hash_table_create (0 , 0 );
3827+ q -> task_group_table = hash_table_create (0 , 0 );
37823828 q -> fetch_factory = 0 ;
37833829
37843830 q -> measured_local_resources = rmsummary_create (-1 );
@@ -4525,6 +4571,9 @@ int vine_submit(struct vine_manager *q, struct vine_task *t)
45254571 /* Ensure category structure is created. */
45264572 vine_category_lookup_or_create (q , t -> category );
45274573
4574+ /* Attemp to group this task based on temp dependencies. */
4575+ vine_task_groups_assign_task (q , t );
4576+
45284577 change_task_state (q , t , VINE_TASK_READY );
45294578
45304579 t -> time_when_submitted = timestamp_get ();
0 commit comments