cctools
work_queue.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2008- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef WORK_QUEUE_H
8 #define WORK_QUEUE_H
9 
20 #include <sys/types.h>
21 #include "timestamp.h"
22 #include "category.h"
23 #include "rmsummary.h"
24 
25 #define WORK_QUEUE_DEFAULT_PORT 9123
26 #define WORK_QUEUE_RANDOM_PORT 0
28 #define WORK_QUEUE_WAITFORTASK -1
30 #define WORK_QUEUE_DEFAULT_KEEPALIVE_INTERVAL 120
31 #define WORK_QUEUE_DEFAULT_KEEPALIVE_TIMEOUT 30
33 typedef enum {
37 
38 typedef enum {
50 
51 typedef enum {
52  WORK_QUEUE_SCHEDULE_UNSET = 0,
59 
60 
61 typedef enum {
77 
78 typedef enum {
87 
88 typedef enum {
96 
97 
98 // Here we repeat the category_mode_t declaration but with work_queue names.
99 // This is needed to generate uniform names in the API and bindings:
100 
101 typedef enum {
116 
117 
118 extern int wq_option_scheduler;
129  char *tag;
130  char *command_line;
132  char *output;
133  struct list *input_files;
134  struct list *output_files;
135  struct list *env_list;
136  int taskid;
139  char *host;
140  char *hostname;
142  char *category;
145  double priority;
148  int try_count;
152  /* All times in microseconds */
153  /* A time_when_* refers to an instant in time, otherwise it refers to a length of time. */
172  int64_t bytes_received;
173  int64_t bytes_sent;
182  struct list *features;
184  /* deprecated fields */
185  //int total_submissions; /**< @deprecated Use try_count. */
186 
213 };
214 
218  /* Stats for the current state of workers: */
225  /* Cumulative stats for workers: */
234  /* Stats for the current state of tasks: */
240  /* Cumulative stats for tasks: */
248  /* All times in microseconds */
249  /* A time_when_* refers to an instant in time, otherwise it refers to a length of time. */
250 
251  /* Master time statistics: */
262  /* Workers time statistics: */
267  /* BW statistics */
268  int64_t bytes_sent;
269  int64_t bytes_received;
270  double bandwidth;
272  /* resources statistics */
281  int64_t total_cores;
282  int64_t total_memory;
283  int64_t total_disk;
285  int64_t committed_cores;
287  int64_t committed_disk;
289  int64_t max_cores;
290  int64_t max_memory;
291  int64_t max_disk;
293  int64_t min_cores;
294  int64_t min_memory;
295  int64_t min_disk;
297  double manager_load;
331  double capacity;
333  double efficiency;
336  int64_t total_gpus;
337  int64_t committed_gpus;
338  int64_t max_gpus;
339  int64_t min_gpus;
341  int port;
342  int priority;
348 };
349 
350 
351 /* Forward declare the queue's structure. This structure is opaque and defined in work_queue.c */
352 struct work_queue;
353 
354 
358 
366 struct work_queue_task *work_queue_task_create(const char *full_command);
367 
373 struct work_queue_task *work_queue_task_clone(const struct work_queue_task *task);
374 
379 void work_queue_task_specify_command( struct work_queue_task *t, const char *cmd );
380 
397 int work_queue_task_specify_file(struct work_queue_task *t, const char *local_name, const char *remote_name, work_queue_file_type_t type, work_queue_file_flags_t flags);
398 
413 int work_queue_task_specify_file_piece(struct work_queue_task *t, const char *local_name, const char *remote_name, off_t start_byte, off_t end_byte, work_queue_file_type_t type, work_queue_file_flags_t flags);
414 
425 int work_queue_task_specify_buffer(struct work_queue_task *t, const char *data, int length, const char *remote_name, work_queue_file_flags_t flags);
426 
440 int work_queue_task_specify_directory(struct work_queue_task *t, const char *local_name, const char *remote_name, work_queue_file_type_t type, work_queue_file_flags_t flags, int recursive);
441 
454 int work_queue_task_specify_file_command(struct work_queue_task *t, const char *remote_name, const char *cmd, work_queue_file_type_t type, work_queue_file_flags_t flags);
455 
462 
468 void work_queue_task_specify_memory( struct work_queue_task *t, int64_t memory );
469 
475 void work_queue_task_specify_disk( struct work_queue_task *t, int64_t disk );
476 
482 void work_queue_task_specify_cores( struct work_queue_task *t, int cores );
483 
489 void work_queue_task_specify_gpus( struct work_queue_task *t, int gpus );
490 
498 void work_queue_task_specify_end_time( struct work_queue_task *t, int64_t useconds );
499 
506 void work_queue_task_specify_start_time_min( struct work_queue_task *t, int64_t useconds );
507 
515 void work_queue_task_specify_running_time( struct work_queue_task *t, int64_t useconds );
516 
524 void work_queue_task_specify_running_time_max( struct work_queue_task *t, int64_t seconds );
525 
532 void work_queue_task_specify_running_time_min( struct work_queue_task *t, int64_t seconds );
533 
540 void work_queue_task_specify_tag(struct work_queue_task *t, const char *tag);
541 
547 void work_queue_task_specify_category(struct work_queue_task *t, const char *category);
548 
553 void work_queue_task_specify_feature(struct work_queue_task *t, const char *name);
554 
562 
569 void work_queue_task_specify_environment_variable( struct work_queue_task *t, const char *name, const char *value );
570 
577 
583 void work_queue_task_specify_monitor_output(struct work_queue_task *t, const char *monitor_output);
584 
590 
591 
643 
644 
646 
650 
667 struct work_queue *work_queue_create(int port);
668 
669 
678 struct work_queue *work_queue_ssl_create(int port, const char *key, const char *cert);
679 
693 int work_queue_enable_monitoring(struct work_queue *q, char *monitor_output_directory, int watchdog);
694 
704 int work_queue_enable_monitoring_full(struct work_queue *q, char *monitor_output_directory, int watchdog);
705 
714 int work_queue_submit(struct work_queue *q, struct work_queue_task *t);
715 
716 
727 int work_queue_specify_min_taskid(struct work_queue *q, int minid);
728 
733 void work_queue_block_host(struct work_queue *q, const char *hostname);
734 
742 void work_queue_block_host_with_timeout(struct work_queue *q, const char *hostname, time_t seconds);
743 
744 
749 void work_queue_unblock_host(struct work_queue *q, const char *hostname);
750 
754 void work_queue_unblock_all(struct work_queue *q);
755 
769 void work_queue_invalidate_cached_file(struct work_queue *q, const char *local_name, work_queue_file_t type);
770 
771 
786 struct work_queue_task *work_queue_wait(struct work_queue *q, int timeout);
787 
788 
796 struct work_queue_task *work_queue_wait_for_tag(struct work_queue *q, const char *tag, int timeout);
797 
809 int work_queue_hungry(struct work_queue *q);
810 
818 int work_queue_empty(struct work_queue *q);
819 
826 int work_queue_port(struct work_queue *q);
827 
832 void work_queue_get_stats(struct work_queue *q, struct work_queue_stats *s);
833 
838 void work_queue_get_stats_hierarchy(struct work_queue *q, struct work_queue_stats *s);
839 
845 void work_queue_get_stats_category(struct work_queue *q, const char *c, struct work_queue_stats *s);
846 
851 char *work_queue_status(struct work_queue *q, const char *request);
852 
853 
858 struct rmsummary **work_queue_workers_summary(struct work_queue *q);
859 
865 work_queue_task_state_t work_queue_task_state(struct work_queue *q, int taskid);
866 
871 void work_queue_set_bandwidth_limit(struct work_queue *q, const char *bandwidth);
872 
877 double work_queue_get_effective_bandwidth(struct work_queue *q);
878 
885 char * work_queue_get_worker_summary( struct work_queue *q );
886 
896 int work_queue_activate_fast_abort(struct work_queue *q, double multiplier);
897 
898 
908 int work_queue_activate_fast_abort_category(struct work_queue *q, const char *category, double multiplier);
909 
910 
919 int work_queue_specify_draining_by_hostname(struct work_queue *q, const char *hostname, int drain_flag);
920 
927 int work_queue_specify_category_mode(struct work_queue *q, const char *category, work_queue_category_mode_t mode);
928 
936 int work_queue_enable_category_resource(struct work_queue *q, const char *category, const char *resource, int autolabel);
937 
943 void work_queue_specify_algorithm(struct work_queue *q, work_queue_schedule_t algorithm);
944 
949 const char *work_queue_name(struct work_queue *q);
950 
955 void work_queue_specify_name(struct work_queue *q, const char *name);
956 
961 void work_queue_specify_debug_path(struct work_queue *q, const char *path);
962 
967 void work_queue_specify_tlq_port(struct work_queue *q, int port);
968 
973 void work_queue_specify_priority(struct work_queue *q, int priority);
974 
983 void work_queue_specify_num_tasks_left(struct work_queue *q, int ntasks);
984 
990 void work_queue_specify_catalog_server(struct work_queue *q, const char *hostname, int port);
991 
996 void work_queue_specify_catalog_servers(struct work_queue *q, const char *hosts);
997 
1003 struct work_queue_task *work_queue_cancel_by_taskid(struct work_queue *q, int id);
1004 
1010 struct work_queue_task *work_queue_cancel_by_tasktag(struct work_queue *q, const char *tag);
1011 
1016 struct list * work_queue_cancel_all_tasks(struct work_queue *q);
1017 
1022 int work_queue_shut_down_workers(struct work_queue *q, int n);
1023 
1028 void work_queue_delete(struct work_queue *q);
1029 
1035 int work_queue_specify_log(struct work_queue *q, const char *logfile);
1036 
1042 int work_queue_specify_transactions_log(struct work_queue *q, const char *logfile);
1043 
1049 void work_queue_specify_password( struct work_queue *q, const char *password );
1050 
1057 int work_queue_specify_password_file( struct work_queue *q, const char *file );
1058 
1063 void work_queue_specify_keepalive_interval(struct work_queue *q, int interval);
1064 
1069 void work_queue_specify_keepalive_timeout(struct work_queue *q, int timeout);
1070 
1076 void work_queue_manager_preferred_connection(struct work_queue *q, const char *preferred_connection);
1077 
1098 int work_queue_tune(struct work_queue *q, const char *name, double value);
1099 
1105 void work_queue_specify_max_resources(struct work_queue *q, const struct rmsummary *rm);
1106 
1112 void work_queue_specify_min_resources(struct work_queue *q, const struct rmsummary *rm);
1113 
1119 void work_queue_specify_category_max_resources(struct work_queue *q, const char *category, const struct rmsummary *rm);
1120 
1126 void work_queue_specify_category_min_resources(struct work_queue *q, const char *category, const struct rmsummary *rm);
1127 
1133 void work_queue_specify_category_first_allocation_guess(struct work_queue *q, const char *category, const struct rmsummary *rm);
1134 
1140 void work_queue_initialize_categories(struct work_queue *q, struct rmsummary *max, const char *summaries_file);
1141 
1142 
1147 const char *work_queue_result_str(work_queue_result_t result);
1148 
1150 
1154 
1155 #define WORK_QUEUE_TASK_ORDER_FIFO 0
1156 #define WORK_QUEUE_TASK_ORDER_LIFO 1
1164 void work_queue_specify_task_order(struct work_queue *q, int order);
1165 
1166 
1167 #define WORK_QUEUE_MANAGER_MODE_STANDALONE 0
1168 #define WORK_QUEUE_MANAGER_MODE_CATALOG 1
1177 void work_queue_specify_manager_mode(struct work_queue *q, int mode);
1178 
1179 
1185 void work_queue_specify_estimate_capacity_on(struct work_queue *q, int estimate_capacity_on);
1186 
1195 int work_queue_task_specify_input_buf(struct work_queue_task *t, const char *buf, int length, const char *rname);
1196 
1204 int work_queue_task_specify_input_file(struct work_queue_task *t, const char *fname, const char *rname);
1205 
1213 int work_queue_task_specify_input_file_do_not_cache(struct work_queue_task *t, const char *fname, const char *rname);
1214 
1222 int work_queue_task_specify_output_file(struct work_queue_task *t, const char *rname, const char *fname);
1223 
1231 int work_queue_task_specify_output_file_do_not_cache(struct work_queue_task *t, const char *rname, const char *fname);
1232 
1238 char *work_queue_generate_disk_alloc_full_filename(char *pwd, int taskid);
1239 
1240 
1243 void work_queue_task_specify_enviroment_variable( struct work_queue_task *t, const char *name, const char *value );
1244 
1246 
1247 // Renames for backwards compatibility
1248 #define work_queue_master_preferred_connection work_queue_manager_preferred_connection
1249 #define work_queue_specify_master_mode work_queue_specify_manager_mode
1250 #define work_queue_blacklist_add work_queue_block_host
1251 #define work_queue_blacklist_add_with_timeout work_queue_block_host_with_timeout
1252 #define work_queue_blacklist_remove work_queue_unblock_host
1253 #define work_queue_blacklist_clear work_queue_unblock_all
1254 
1255 #endif
int64_t total_memory
Total memory in MB aggregated across the connected workers.
Definition: work_queue.h:282
int work_queue_specify_min_taskid(struct work_queue *q, int minid)
Set the minimum taskid of future submitted tasks.
As above, but tasks are first tried with an automatically computed allocation to minimize resource wa...
Definition: work_queue.h:112
Only return this output file if the task succeeded.
Definition: work_queue.h:46
int try_count
The number of times the task has been dispatched to a worker.
Definition: work_queue.h:148
Task is ready to be run, waiting in queue.
Definition: work_queue.h:80
int64_t committed_gpus
Definition: work_queue.h:337
void work_queue_manager_preferred_connection(struct work_queue *q, const char *preferred_connection)
Set the preference for using hostname over IP address to connect.
int64_t bytes_sent
Number of bytes sent since task has last started sending input data.
Definition: work_queue.h:173
If the filename already exists on the host, use it in place.
Definition: work_queue.h:48
int work_queue_task_specify_file_command(struct work_queue_task *t, const char *remote_name, const char *cmd, work_queue_file_type_t type, work_queue_file_flags_t flags)
Gets/puts file at remote_name using cmd at worker.
void work_queue_specify_estimate_capacity_on(struct work_queue *q, int estimate_capacity_on)
Change whether to estimate manager capacity for a given queue.
timestamp_t time_workers_execute
Total time workers spent executing done tasks.
Definition: work_queue.h:263
int64_t bytes_received
Number of bytes received since task has last started receiving input data.
Definition: work_queue.h:172
category_allocation_t resource_request
See category_allocation_t.
Definition: work_queue.h:143
int64_t committed_disk
Committed disk space in MB aggregated across the connected workers.
Definition: work_queue.h:287
Task results are available at the worker.
Definition: work_queue.h:82
int workers_connected
Number of workers currently connected to the manager.
Definition: work_queue.h:219
int capacity_cores
The estimated number of workers&#39; cores that this manager can effectively support. ...
Definition: work_queue.h:274
int total_exhausted_attempts
Definition: work_queue.h:318
int64_t min_disk
The smallest disk space in MB observed among the connected workers.
Definition: work_queue.h:295
int disk_allocation_exhausted
Non-zero if a task filled its loop device allocation, zero otherwise.
Definition: work_queue.h:157
int work_queue_task_specify_file_piece(struct work_queue_task *t, const char *local_name, const char *remote_name, off_t start_byte, off_t end_byte, work_queue_file_type_t type, work_queue_file_flags_t flags)
Add a file piece to a task.
A task description.
Definition: work_queue.h:128
void work_queue_task_specify_cores(struct work_queue_task *t, int cores)
Specify the number of cores required by a task.
int workers_lost
Total number of worker connections that were unexpectedly lost.
Definition: work_queue.h:232
int work_queue_task_specify_directory(struct work_queue_task *t, const char *local_name, const char *remote_name, work_queue_file_type_t type, work_queue_file_flags_t flags, int recursive)
Add a directory to a task.
void work_queue_task_specify_feature(struct work_queue_task *t, const char *name)
Label the task with a user-defined feature.
timestamp_t total_good_execute_time
Definition: work_queue.h:325
timestamp_t time_send_good
Total time spent in sending data to workers for tasks with result WQ_RESULT_SUCCESS.
Definition: work_queue.h:255
timestamp_t time_send_input_start
Definition: work_queue.h:191
int tasks_on_workers
Number of tasks currently dispatched to some worker.
Definition: work_queue.h:236
int tasks_dispatched
Total number of tasks dispatch to workers.
Definition: work_queue.h:242
void work_queue_task_specify_enviroment_variable(struct work_queue_task *t, const char *name, const char *value)
Same as work_queue_task_specify_environment_variable, but with a typo in environment.
struct list * work_queue_cancel_all_tasks(struct work_queue *q)
Cancel all submitted tasks and remove them from the queue.
timestamp_t start_time
Definition: work_queue.h:319
timestamp_t cmd_execution_time
Definition: work_queue.h:203
int work_queue_specify_draining_by_hostname(struct work_queue *q, const char *hostname, int drain_flag)
Set the draining mode per worker hostname.
char * monitor_output_directory
Custom output directory for the monitoring output files.
Definition: work_queue.h:179
struct list * features
User-defined features this task requires.
Definition: work_queue.h:182
int64_t bytes_received
Total number of file bytes (not including protocol control msg bytes) received from the workers by th...
Definition: work_queue.h:269
int tasks_running
Number of tasks currently executing at some worker.
Definition: work_queue.h:237
int work_queue_task_specify_input_file_do_not_cache(struct work_queue_task *t, const char *fname, const char *rname)
Add an input file to a task, without caching.
int total_workers_joined
Definition: work_queue.h:306
timestamp_t time_receive_good
Total time spent in sending data to workers for tasks with result WQ_RESULT_SUCCESS.
Definition: work_queue.h:256
Task results are available at the manager.
Definition: work_queue.h:83
timestamp_t total_exhausted_execute_time
Definition: work_queue.h:326
Implements bookkeeping for categories of tasks and their resources.
int workers_joined
Total number of worker connections that were established to the manager.
Definition: work_queue.h:226
int work_queue_task_specify_output_file(struct work_queue_task *t, const char *rname, const char *fname)
Add an output file to a task.
When monitoring is enabled, tasks are tried with maximum specified values of cores, memory, disk or gpus until enough statistics are collected.
Definition: category.h:40
When monitoring is disabled, all tasks run as WORK_QUEUE_ALLOCATION_MODE_FIXED.
Definition: work_queue.h:102
timestamp_t time_when_submitted
The time at which this task was added to the queue.
Definition: work_queue.h:154
timestamp_t time_workers_execute_last
Duration of the last complete execution for this task.
Definition: work_queue.h:167
timestamp_t time_receive_output_start
Definition: work_queue.h:195
int workers_blacklisted
Definition: work_queue.h:347
timestamp_t total_cmd_execution_time
Definition: work_queue.h:204
void work_queue_get_stats(struct work_queue *q, struct work_queue_stats *s)
Get queue statistics (only from manager).
int workers_removed
Total number of worker connections that were released by the manager, idled-out, fast-aborted, or lost.
Definition: work_queue.h:227
struct work_queue_task * work_queue_cancel_by_taskid(struct work_queue *q, int id)
Cancel a submitted task using its task id and remove it from queue.
int workers_full
Definition: work_queue.h:344
timestamp_t time_workers_execute_all
Accumulated time for executing the command on any worker, regardless of whether the task completed (i...
Definition: work_queue.h:168
void work_queue_specify_debug_path(struct work_queue *q, const char *path)
Change the debug log path for a given queue (used by TLQ).
int total_tasks_dispatched
Definition: work_queue.h:314
int capacity_memory
The estimated number of workers&#39; MB of RAM that this manager can effectively support.
Definition: work_queue.h:275
struct work_queue * work_queue_create(int port)
Create a new work queue.
The task failed because an output could be transfered to the manager (not enough disk space...
Definition: work_queue.h:75
timestamp_t total_good_transfer_time
Definition: work_queue.h:322
int workers_init
Number of workers connected, but that have not send their available resources report yet...
Definition: work_queue.h:220
int work_queue_enable_category_resource(struct work_queue *q, const char *category, const char *resource, int autolabel)
Turn on or off first-allocation labeling for a given category and resource.
int work_queue_task_specify_output_file_do_not_cache(struct work_queue_task *t, const char *rname, const char *fname)
Add an output file to a task without caching.
void work_queue_specify_tlq_port(struct work_queue *q, int port)
Change the home host and port for a given queue (used by TLQ).
timestamp_t time_send_input_finish
Definition: work_queue.h:192
void work_queue_block_host_with_timeout(struct work_queue *q, const char *hostname, time_t seconds)
Block workers in hostname from a queue, but remove block after timeout seconds.
void work_queue_get_stats_hierarchy(struct work_queue *q, struct work_queue_stats *s)
Get statistics of the manager queue together with foremen information.
timestamp_t time_app_delay
Definition: work_queue.h:212
int exhausted_attempts
Number of times the task failed given exhausted resources.
Definition: work_queue.h:149
void work_queue_task_specify_command(struct work_queue_task *t, const char *cmd)
Indicate the command to be executed.
void work_queue_task_specify_running_time_max(struct work_queue_task *t, int64_t seconds)
Specify the maximum time (in seconds) the task is allowed to run in a worker.
int tasks_waiting
Number of tasks waiting to be dispatched.
Definition: work_queue.h:235
work_queue_task_state_t
Definition: work_queue.h:78
int workers_released
Total number of worker connections that were asked by the manager to disconnect.
Definition: work_queue.h:228
char * hostname
The name of the host on which it ran.
Definition: work_queue.h:140
void work_queue_invalidate_cached_file(struct work_queue *q, const char *local_name, work_queue_file_t type)
Invalidate cached file.
The task ran for more than the specified time (relative since running in a worker).
Definition: work_queue.h:72
Portable routines for high resolution timing.
double work_queue_get_effective_bandwidth(struct work_queue *q)
Get current queue bandwidth.
int work_queue_specify_category_mode(struct work_queue *q, const char *category, work_queue_category_mode_t mode)
Turn on or off first-allocation labeling for a given category.
int64_t total_gpus
Definition: work_queue.h:336
The task ran but failed to generate a specified output file.
Definition: work_queue.h:64
int64_t total_bytes_sent
Definition: work_queue.h:328
struct list * output_files
The output files (other than the standard output stream) created by the program to be retrieved from ...
Definition: work_queue.h:134
int priority
Definition: work_queue.h:342
int64_t total_bytes_transferred
Definition: work_queue.h:210
void work_queue_delete(struct work_queue *q)
Delete a work queue.
UINT64_T timestamp_t
A type to hold the current time, in microseconds since January 1st, 1970.
Definition: timestamp.h:20
struct list * env_list
Environment variables applied to the task.
Definition: work_queue.h:135
int tasks_complete
Definition: work_queue.h:312
int64_t min_gpus
Definition: work_queue.h:339
struct list * input_files
The files to transfer to the worker and place in the executing directory.
Definition: work_queue.h:133
double bandwidth
Average network bandwidth in MB/S observed by the manager when transferring to workers.
Definition: work_queue.h:270
struct work_queue_task * work_queue_cancel_by_tasktag(struct work_queue *q, const char *tag)
Cancel a submitted task using its tag and remove it from queue.
work_queue_task_state_t work_queue_task_state(struct work_queue *q, int taskid)
Get the current state of the task.
int capacity_gpus
The estimated number of workers&#39; GPUs that this manager can effectively support.
Definition: work_queue.h:277
int tasks_exhausted_attempts
Total number of task executions that failed given resource exhaustion.
Definition: work_queue.h:246
void work_queue_task_specify_running_time(struct work_queue_task *t, int64_t useconds)
Specify the maximum time (in microseconds) the task is allowed to run in a worker.
char * category
User-provided label for the task.
Definition: work_queue.h:142
double manager_load
In the range of [0,1].
Definition: work_queue.h:297
int total_tasks_complete
Definition: work_queue.h:315
void work_queue_specify_catalog_servers(struct work_queue *q, const char *hosts)
Specify the catalog server(s) the manager should report to.
struct work_queue_task * work_queue_wait(struct work_queue *q, int timeout)
Wait for a task to complete.
timestamp_t time_when_retrieval
The time when output files start to be transfered back to the manager.
Definition: work_queue.h:165
void work_queue_task_specify_memory(struct work_queue_task *t, int64_t memory)
Specify the amount of disk space required by a task.
char * command_line
The program(s) to execute, as a shell command line.
Definition: work_queue.h:130
timestamp_t total_cmd_exhausted_execute_time
Definition: work_queue.h:205
The task filled its loop device allocation but needed more space.
Definition: work_queue.h:73
There is no such task.
Definition: work_queue.h:79
int64_t committed_memory
Committed memory in MB aggregated across the connected workers.
Definition: work_queue.h:286
timestamp_t total_time_until_worker_failure
Definition: work_queue.h:206
int total_workers_removed
Definition: work_queue.h:307
File-spec is a regular file.
Definition: work_queue.h:89
Task is done, and returned through work_queue_wait &gt;
Definition: work_queue.h:84
The result could not be classified.
Definition: work_queue.h:69
struct work_queue * work_queue_ssl_create(int port, const char *key, const char *cert)
Create a new work queue using SSL.
void work_queue_unblock_host(struct work_queue *q, const char *hostname)
Unblock host from a queue.
Specify an output object.
Definition: work_queue.h:35
The task failed, but it was not a task error.
Definition: work_queue.h:70
int work_queue_specify_log(struct work_queue *q, const char *logfile)
Add a log file that records cummulative statistics of the connected workers and submitted tasks...
timestamp_t time_receive_output_finish
Definition: work_queue.h:196
Select worker that has the most data required by the task.
Definition: work_queue.h:54
int total_workers_fast_aborted
Definition: work_queue.h:310
timestamp_t time_task_submit
Definition: work_queue.h:187
void work_queue_task_specify_start_time_min(struct work_queue_task *t, int64_t useconds)
Specify the minimum start time allowed for the task (in microseconds since the Epoch).
timestamp_t time_receive_result_finish
Definition: work_queue.h:194
int work_queue_task_specify_input_buf(struct work_queue_task *t, const char *buf, int length, const char *rname)
Add an input buffer to a task.
int64_t committed_cores
Committed number of cores aggregated across the connected workers.
Definition: work_queue.h:285
void work_queue_specify_catalog_server(struct work_queue *q, const char *hostname, int port)
Specify the catalog server the manager should report to.
char * host
The address and port of the host on which it ran.
Definition: work_queue.h:139
timestamp_t time_when_commit_end
The time when the task is completely transfered to a worker.
Definition: work_queue.h:163
int work_queue_port(struct work_queue *q)
Get the listening port of the queue.
work_queue_schedule_t
Definition: work_queue.h:51
int work_queue_specify_password_file(struct work_queue *q, const char *file)
Add a mandatory password file that each worker must present.
Access the file on the client from a shared filesystem (same as WORK_QUEUE_THIRDGET, included for readability)
Definition: work_queue.h:43
int taskid
A unique task id number.
Definition: work_queue.h:136
int fast_abort_count
Number of times this task has been terminated for running too long.
Definition: work_queue.h:150
int avg_capacity
Definition: work_queue.h:346
int workers_busy
Number of workers that are running at least one task.
Definition: work_queue.h:222
void work_queue_task_specify_running_time_min(struct work_queue_task *t, int64_t seconds)
Specify the minimum time (in seconds) the task is expected to run in a worker.
timestamp_t time_polling
Total time blocking waiting for worker communications (i.e., manager idle waiting for a worker messag...
Definition: work_queue.h:259
struct work_queue_task * work_queue_task_create(const char *full_command)
Create a new task object.
File-spec refers to an URL.
Definition: work_queue.h:94
When monitoring is enabled, tasks are tried with maximum specified values of cores, memory, disk or gpus until enough statistics are collected.
Definition: work_queue.h:105
void work_queue_specify_password(struct work_queue *q, const char *password)
Add a mandatory password that each worker must present.
int capacity_tasks
The estimated number of tasks that this manager can effectively support.
Definition: work_queue.h:273
struct rmsummary * resources_measured
When monitoring is enabled, it points to the measured resources used by the task in its latest attemp...
Definition: work_queue.h:177
timestamp_t time_status_msgs
Total time spent sending and receiving status messages to and from workers, including workers&#39; standa...
Definition: work_queue.h:257
timestamp_t time_committed
Definition: work_queue.h:189
int workers_fast_aborted
Total number of worker connections terminated for being too slow.
Definition: work_queue.h:230
As above, but maximizing throughput.
Definition: work_queue.h:114
void work_queue_unblock_all(struct work_queue *q)
Unblock all host.
int port
Definition: work_queue.h:341
work_queue_schedule_t worker_selection_algorithm
How to choose worker to run the task.
Definition: work_queue.h:131
The task ran successfully.
Definition: work_queue.h:62
int64_t total_bytes_received
Definition: work_queue.h:329
void work_queue_task_specify_tag(struct work_queue_task *t, const char *tag)
Attach a user defined string tag to the task.
timestamp_t time_workers_execute_failure
Accumulated time for runs that terminated in worker failure/disconnection.
Definition: work_queue.h:170
timestamp_t time_when_done
The time at which the task is mark as retrieved, after transfering output files and other final proce...
Definition: work_queue.h:155
int total_tasks_cancelled
Definition: work_queue.h:317
Create a symlink to the file rather than copying it, if possible.
Definition: work_queue.h:41
category_allocation_t
Valid states for the lifetime of automatic resource allocations for a single task.
Definition: category.h:21
struct rmsummary * resources_allocated
Resources allocated to the task its latest attempt.
Definition: work_queue.h:176
void work_queue_task_specify_priority(struct work_queue_task *t, double priority)
Specify the priority of this task relative to others in the queue.
The task failed because the monitor did not produce a summary report.
Definition: work_queue.h:74
int max_retries
Number of times the task is tried to be executed on some workers until success.
Definition: work_queue.h:146
struct rmsummary * resources_requested
Number of cores, disk, memory, time, etc.
Definition: work_queue.h:178
File-spec is a regular file.
Definition: work_queue.h:91
work_queue_result_t result
The result of the task (see work_queue_result_t.
Definition: work_queue.h:138
As above, but maximizing throughput.
Definition: category.h:56
void work_queue_task_specify_max_retries(struct work_queue_task *t, int64_t max_retries)
Specify the number of times this task is retried on worker errors.
struct work_queue_task * work_queue_task_clone(const struct work_queue_task *task)
Create a copy of a task Create a functionally identical copy of a work_queue_task that can be re-sub...
int work_queue_empty(struct work_queue *q)
Determine whether the queue is empty.
Only return this output file if the task failed.
Definition: work_queue.h:45
int tasks_failed
Total number of tasks completed and returned to user with result other than WQ_RESULT_SUCCESS.
Definition: work_queue.h:244
void work_queue_task_specify_disk(struct work_queue_task *t, int64_t disk)
Specify the amount of disk space required by a task.
int work_queue_shut_down_workers(struct work_queue *q, int n)
Shut down workers connected to the work_queue system.
void work_queue_task_specify_algorithm(struct work_queue_task *t, work_queue_schedule_t algorithm)
Select the scheduling algorithm for a single task.
work_queue_file_type_t
Definition: work_queue.h:33
int64_t min_memory
The smallest memory size in MB observed among the connected workers.
Definition: work_queue.h:294
void work_queue_set_bandwidth_limit(struct work_queue *q, const char *bandwidth)
Limit the queue bandwidth when transferring files to and from workers.
struct rmsummary ** work_queue_workers_summary(struct work_queue *q)
Summary data for all workers in buffer.
void work_queue_task_specify_category(struct work_queue_task *t, const char *category)
Label the task with the given category.
work_queue_result_t
Definition: work_queue.h:61
timestamp_t time_workers_execute_good
Total time workers spent executing done tasks with result WQ_RESULT_SUCCESS.
Definition: work_queue.h:264
Cache file at execution site for later use.
Definition: work_queue.h:40
int64_t bytes_transferred
Number of bytes transferred since task has last started transferring input data.
Definition: work_queue.h:174
int total_workers_idled_out
Definition: work_queue.h:309
File-spec is a directory.
Definition: work_queue.h:93
The task ran after the specified (absolute since epoch) end time.
Definition: work_queue.h:68
const char * work_queue_name(struct work_queue *q)
Get the project name of the queue.
int total_workers_lost
Definition: work_queue.h:308
double priority
The priority of this task relative to others in the queue: higher number run earlier.
Definition: work_queue.h:145
void work_queue_get_stats_category(struct work_queue *q, const char *c, struct work_queue_stats *s)
Get the task statistics for the given category.
timestamp_t time_workers_execute_exhaustion
Total time workers spent executing tasks that exhausted resources.
Definition: work_queue.h:265
int tasks_submitted
Total number of tasks submitted to the queue.
Definition: work_queue.h:241
void work_queue_specify_keepalive_timeout(struct work_queue *q, int timeout)
Change the keepalive timeout for identifying dead workers for a given queue.
int work_queue_enable_monitoring(struct work_queue *q, char *monitor_output_directory, int watchdog)
Enables resource monitoring on the give work queue.
const char * work_queue_result_str(work_queue_result_t result)
Explain result codes from tasks.
void work_queue_specify_num_tasks_left(struct work_queue *q, int ntasks)
Specify the number of tasks not yet submitted to the queue.
Watch the output file and send back changes as the task runs.
Definition: work_queue.h:44
int64_t min_running_time
Minimum time (in seconds) the task needs to run.
Definition: work_queue.h:159
Statistics describing a work queue.
Definition: work_queue.h:217
Definition: rmsummary.h:26
As above, but tasks are first tried with an automatically computed allocation to minimize resource wa...
Definition: category.h:52
timestamp_t time_when_commit_start
The time when the task starts to be transfered to a worker.
Definition: work_queue.h:162
int capacity_disk
The estimated number of workers&#39; MB of disk that this manager can effectively support.
Definition: work_queue.h:276
void work_queue_specify_category_min_resources(struct work_queue *q, const char *category, const struct rmsummary *rm)
Sets the minimum resources a task in the category may use.
void work_queue_specify_max_resources(struct work_queue *q, const struct rmsummary *rm)
Sets the maximum resources a task without an explicit category (&quot;default&quot; category).
timestamp_t time_receive_result_start
Definition: work_queue.h:193
int return_status
The exit code of the command line.
Definition: work_queue.h:137
Select worker on a first-come-first-serve basis.
Definition: work_queue.h:53
int64_t bytes_sent
Total number of file bytes (not including protocol control msg bytes) sent out to the workers by the ...
Definition: work_queue.h:268
int64_t min_cores
The lowest number of cores observed among the connected workers.
Definition: work_queue.h:293
int64_t max_gpus
Definition: work_queue.h:338
Access the file on the client from a shared filesystem.
Definition: work_queue.h:42
void work_queue_task_specify_gpus(struct work_queue_task *t, int gpus)
Specify the number of gpus required by a task.
int total_workers_connected
Definition: work_queue.h:305
timestamp_t total_receive_time
Definition: work_queue.h:321
int work_queue_enable_monitoring_full(struct work_queue *q, char *monitor_output_directory, int watchdog)
Enables resource monitoring on the give work queue.
int tasks_with_results
Number of tasks with retrieved results and waiting to be returned to user.
Definition: work_queue.h:238
int work_queue_hungry(struct work_queue *q)
Determine whether the queue is &#39;hungry&#39; for more tasks.
The task could not be completed successfully in the given number of retries.
Definition: work_queue.h:71
int work_queue_activate_fast_abort_category(struct work_queue *q, const char *category, double multiplier)
Turn on or off fast abort functionality for a given category.
Task has been dispatched to some worker.
Definition: work_queue.h:81
int work_queue_tune(struct work_queue *q, const char *name, double value)
Tune advanced parameters for work queue.
void work_queue_block_host(struct work_queue *q, const char *hostname)
Block workers in hostname from working for queue q.
int64_t total_cores
Total number of cores aggregated across the connected workers.
Definition: work_queue.h:281
Select a random worker.
Definition: work_queue.h:56
void work_queue_specify_min_resources(struct work_queue *q, const struct rmsummary *rm)
Sets the minimum resources a task without an explicit category (&quot;default&quot; category).
The task cannot be run due to a missing input file.
Definition: work_queue.h:63
int tasks_done
Total number of tasks completed and returned to user.
Definition: work_queue.h:243
double capacity
Definition: work_queue.h:331
int total_worker_slots
Definition: work_queue.h:345
struct work_queue_task * work_queue_wait_for_tag(struct work_queue *q, const char *tag, int timeout)
Wait for a task with a given task to complete.
timestamp_t time_internal
Total time the queue spents in internal processing.
Definition: work_queue.h:258
int64_t max_disk
The largest disk space in MB observed among the connected workers.
Definition: work_queue.h:291
Select worker that has the fastest execution time on previous tasks.
Definition: work_queue.h:55
timestamp_t total_transfer_time
Definition: work_queue.h:201
double idle_percentage
Definition: work_queue.h:334
Task was canceled before completion.
Definition: work_queue.h:85
void work_queue_task_specify_environment_variable(struct work_queue_task *t, const char *name, const char *value)
Specify an environment variable to be added to the task.
int work_queue_activate_fast_abort(struct work_queue *q, double multiplier)
Turn on or off fast abort functionality for a given queue for tasks without an explicit category...
int64_t total_disk
Total disk space in MB aggregated across the connected workers.
Definition: work_queue.h:283
char * tag
An optional user-defined logical name for the task.
Definition: work_queue.h:129
timestamp_t time_when_started
Absolute time at which the manager started.
Definition: work_queue.h:252
timestamp_t total_execute_time
Definition: work_queue.h:324
int work_queue_submit(struct work_queue *q, struct work_queue_task *t)
Submit a task to a queue.
timestamp_t time_execute_cmd_finish
Definition: work_queue.h:199
Select the worst fit worker (the worker with more unused resources).
Definition: work_queue.h:57
int workers_idled_out
Total number of worker that disconnected for being idle.
Definition: work_queue.h:229
double efficiency
Definition: work_queue.h:333
void work_queue_specify_keepalive_interval(struct work_queue *q, int interval)
Change the keepalive interval for a given queue.
The task was terminated with a signal.
Definition: work_queue.h:66
timestamp_t time_task_finish
Definition: work_queue.h:188
int work_queue_task_specify_input_file(struct work_queue_task *t, const char *fname, const char *rname)
Add an input file to a task.
int workers_able
Number of workers on which the largest task can run.
Definition: work_queue.h:223
timestamp_t time_execute_cmd_start
Definition: work_queue.h:198
char * monitor_snapshot_file
Filename the monitor checks to produce snapshots.
Definition: work_queue.h:181
int workers_idle
Number of workers that are not running a task.
Definition: work_queue.h:221
int wq_option_scheduler
Initial setting for algorithm to assign tasks to workers upon creating queue .
void work_queue_task_specify_end_time(struct work_queue_task *t, int64_t useconds)
Specify the maximum end time allowed for the task (in microseconds since the Epoch).
timestamp_t time_send
Total time spent in sending tasks to workers (tasks descriptions, and input files.).
Definition: work_queue.h:253
int workers_blocked
Total number of workers blocked by the manager.
Definition: work_queue.h:231
int work_queue_specify_snapshot_file(struct work_queue_task *t, const char *monitor_snapshot_file)
When monitoring, indicates a json-encoded file that instructs the monitor to take a snapshot of the ...
void work_queue_specify_category_max_resources(struct work_queue *q, const char *category, const struct rmsummary *rm)
Sets the maximum resources a task in the category may use.
int64_t total_bytes_sent
Definition: work_queue.h:209
timestamp_t total_send_time
Definition: work_queue.h:320
work_queue_file_t
Definition: work_queue.h:88
char * work_queue_get_worker_summary(struct work_queue *q)
Summarize workers.
void work_queue_initialize_categories(struct work_queue *q, struct rmsummary *max, const char *summaries_file)
Initialize first value of categories.
void work_queue_specify_priority(struct work_queue *q, int priority)
Change the priority for a given queue.
int capacity_instantaneous
The estimated number of tasks that this manager can support considering only the most recently comple...
Definition: work_queue.h:278
int64_t total_bytes_received
Definition: work_queue.h:208
int total_tasks_failed
Definition: work_queue.h:316
work_queue_category_mode_t
Definition: work_queue.h:101
Data comes from buffer memory.
Definition: work_queue.h:90
timestamp_t time_receive
Total time spent in receiving results from workers (output files.).
Definition: work_queue.h:254
int work_queue_specify_transactions_log(struct work_queue *q, const char *logfile)
Add a log file that records the states of the connected workers and tasks.
int64_t max_memory
The largest memory size in MB observed among the connected workers.
Definition: work_queue.h:290
char * work_queue_status(struct work_queue *q, const char *request)
Get queue information as json.
void work_queue_task_specify_monitor_output(struct work_queue_task *t, const char *monitor_output)
Specify a custom name for the monitoring summary.
void work_queue_task_delete(struct work_queue_task *t)
Delete a task.
int work_queue_task_specify_buffer(struct work_queue_task *t, const char *data, int length, const char *remote_name, work_queue_file_flags_t flags)
Add an input buffer to a task.
int work_queue_task_specify_file(struct work_queue_task *t, const char *local_name, const char *remote_name, work_queue_file_type_t type, work_queue_file_flags_t flags)
Add a file to a task.
timestamp_t time_workers_execute_exhaustion
Accumulated time spent in attempts that exhausted resources.
Definition: work_queue.h:169
char * output
The standard output of the task.
Definition: work_queue.h:132
work_queue_file_flags_t
Definition: work_queue.h:38
timestamp_t time_application
Total time spent outside work_queue_wait.
Definition: work_queue.h:260
void work_queue_specify_category_first_allocation_guess(struct work_queue *q, const char *category, const struct rmsummary *rm)
Set the initial guess for resource autolabeling for the given category.
The task used more resources than requested.
Definition: work_queue.h:67
void work_queue_specify_name(struct work_queue *q, const char *name)
Change the project name for a given queue.
File-spec refers to only a part of a file.
Definition: work_queue.h:92
When monitoring is disabled, all tasks run as WORK_QUEUE_ALLOCATION_MODE_FIXED.
Definition: category.h:33
int workers_ready
Definition: work_queue.h:343
void work_queue_specify_algorithm(struct work_queue *q, work_queue_schedule_t algorithm)
Change the worker selection algorithm.
Do not cache file at execution site.
Definition: work_queue.h:39
char * work_queue_generate_disk_alloc_full_filename(char *pwd, int taskid)
Generate a worker-level unique filename to indicate a disk allocation being full. ...
Specify an input object.
Definition: work_queue.h:34
Definition: category.h:61
int capacity_weighted
The estimated number of tasks that this manager can support placing greater weight on the most recent...
Definition: work_queue.h:279
int64_t max_cores
The highest number of cores observed among the connected workers.
Definition: work_queue.h:289
int tasks_cancelled
Total number of tasks cancelled.
Definition: work_queue.h:245
The task ran but its stdout has been truncated.
Definition: work_queue.h:65