work_queue.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2008- The University of Notre Dame
00003 This software is distributed under the GNU General Public License.
00004 See the file COPYING for details.
00005 */
00006 
00007 #ifndef WORK_QUEUE_H
00008 #define WORK_QUEUE_H
00009 
00020 #include <sys/types.h>
00021 #include "timestamp.h"
00022 
00023 #define WORK_QUEUE_DEFAULT_PORT 9123  
00024 #define WORK_QUEUE_RANDOM_PORT  0    
00025 #define WORK_QUEUE_WAITFORTASK  -1    
00027 #define WORK_QUEUE_SCHEDULE_UNSET 0
00028 #define WORK_QUEUE_SCHEDULE_FCFS         1 
00029 #define WORK_QUEUE_SCHEDULE_FILES        2 
00030 #define WORK_QUEUE_SCHEDULE_TIME         3 
00031 #define WORK_QUEUE_SCHEDULE_RAND         4 
00033 #define WORK_QUEUE_TASK_ORDER_FIFO 0  
00034 #define WORK_QUEUE_TASK_ORDER_LIFO 1  
00036 #define WORK_QUEUE_INPUT  0     
00037 #define WORK_QUEUE_OUTPUT 1     
00039 #define WORK_QUEUE_NOCACHE 0    
00040 #define WORK_QUEUE_CACHE 1      
00041 #define WORK_QUEUE_SYMLINK 2    /* Create a symlink to the file rather than copying it, if possible. */
00042 #define WORK_QUEUE_PREEXIST 4   /* If the filename already exists on the host, use it in place. */
00043 #define WORK_QUEUE_THIRDGET 8   /* Access the file on the client from a shared filesystem */
00044 #define WORK_QUEUE_THIRDPUT 8   /* Access the file on the client from a shared filesystem (included for readability) */
00045 
00046 #define WORK_QUEUE_RESET_ALL        0  
00047 #define WORK_QUEUE_RESET_KEEP_TASKS 1  
00049 #define WORK_QUEUE_DEFAULT_KEEPALIVE_INTERVAL 300  
00050 #define WORK_QUEUE_DEFAULT_KEEPALIVE_TIMEOUT 30    
00052 extern double wq_option_fast_abort_multiplier; 
00053 extern int wq_option_scheduler; 
00057 struct work_queue_task {
00058         char *tag;                      
00059         char *command_line;             
00060         int worker_selection_algorithm;           
00061         char *output;                   
00062         struct list *input_files;       
00063         struct list *output_files;      
00064         int taskid;                     
00065         int return_status;              
00066         int result;                     
00067         char *host;                     
00068         char *hostname;                 
00070         timestamp_t time_task_submit;   
00071         timestamp_t time_task_finish;   
00072         timestamp_t time_app_delay;      
00073         timestamp_t time_send_input_start;      
00074         timestamp_t time_send_input_finish;     
00075         timestamp_t time_execute_cmd_start;                 
00076         timestamp_t time_execute_cmd_finish;            
00077         timestamp_t time_receive_output_start;  
00078         timestamp_t time_receive_output_finish; 
00080         INT64_T total_bytes_transferred;
00081         timestamp_t total_transfer_time;    
00082         timestamp_t cmd_execution_time;    
00084         int memory;                       
00085         int disk;
00086         int cores;
00087         int unlabeled;
00088 };
00089 
00092 struct work_queue_stats {
00093         int port;
00094         int priority;
00095         int workers_init;               
00096         int workers_ready;              
00097         int workers_busy;               
00098         int workers_full;               
00099         int tasks_running;              
00100         int tasks_waiting;              
00101         int tasks_complete;             
00102         int total_tasks_dispatched;     
00103         int total_tasks_complete;       
00104         int total_workers_joined;       
00105         int total_workers_removed;      
00106         INT64_T total_bytes_sent;       
00107         INT64_T total_bytes_received;   
00108         timestamp_t start_time;         
00109         timestamp_t total_send_time;    
00110         timestamp_t total_receive_time; 
00111         double efficiency;
00112         double idle_percentage;
00113         int capacity;
00114         int avg_capacity;
00115         int total_workers_connected;
00116         int total_worker_slots;                 
00117 };
00118 
00119 
00123 
00131 struct work_queue_task *work_queue_task_create(const char *full_command);
00132 
00137 void work_queue_task_specify_command( struct work_queue_task *t, const char *cmd );
00138 
00151 int work_queue_task_specify_file(struct work_queue_task *t, const char *local_name, const char *remote_name, int type, int flags);
00152 
00167 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, int type, int flags);
00168 
00179 int work_queue_task_specify_buffer(struct work_queue_task *t, const char *data, int length, const char *remote_name, int flags);
00180 
00194 int work_queue_task_specify_directory(struct work_queue_task *t, const char *local_name, const char *remote_name, int type, int flags, int recursive);
00195 
00201 void work_queue_task_specify_memory( struct work_queue_task *t, int memory );
00202 
00208 void work_queue_task_specify_disk( struct work_queue_task *t, int disk );
00209 
00215 void work_queue_task_specify_cores( struct work_queue_task *t, int cores );
00216 
00223 void work_queue_task_specify_tag(struct work_queue_task *t, const char *tag);
00224 
00234 void work_queue_task_specify_algorithm(struct work_queue_task *t, int algo );
00235 
00240 void work_queue_task_delete(struct work_queue_task *t);
00241 
00243 
00247 
00264 struct work_queue *work_queue_create(int port);
00265 
00273 int work_queue_enable_monitoring(struct work_queue *q, char *monitor_summary_file);
00274 
00283 int work_queue_submit(struct work_queue *q, struct work_queue_task *t);
00284 
00299 struct work_queue_task *work_queue_wait(struct work_queue *q, int timeout);
00300 
00312 int work_queue_hungry(struct work_queue *q);
00313 
00321 int work_queue_empty(struct work_queue *q);
00322 
00329 int work_queue_port(struct work_queue *q);
00330 
00335 void work_queue_get_stats(struct work_queue *q, struct work_queue_stats *s);
00336 
00343 char * work_queue_get_worker_summary( struct work_queue *q );
00344 
00350 int work_queue_activate_fast_abort(struct work_queue *q, double multiplier);
00351 
00363 void work_queue_specify_algorithm(struct work_queue *q, int algo);
00364 
00374 void work_queue_specify_task_order(struct work_queue *q, int order);
00375 
00380 const char *work_queue_name(struct work_queue *q);
00381 
00386 void work_queue_specify_name(struct work_queue *q, const char *name);
00387 
00392 void work_queue_specify_priority(struct work_queue *q, int priority);
00393 
00398 void work_queue_specify_estimate_capacity_on(struct work_queue *q, int estimate_capacity_on);
00399 
00405 void work_queue_specify_catalog_server(struct work_queue *q, const char *hostname, int port);
00406 
00412 struct work_queue_task *work_queue_cancel_by_taskid(struct work_queue *q, int id);
00413 
00419 struct work_queue_task *work_queue_cancel_by_tasktag(struct work_queue *q, const char *tag);
00420 
00425 struct list * work_queue_cancel_all_tasks(struct work_queue *q);
00426 
00433 void work_queue_reset(struct work_queue *q, int flags);
00434 
00439 int work_queue_shut_down_workers(struct work_queue *q, int n);
00440 
00445 void work_queue_delete(struct work_queue *q);
00446 
00451 void work_queue_specify_log(struct work_queue *q, const char *logfile);
00452 
00458 void work_queue_specify_password( struct work_queue *q, const char *password );
00459 
00466 int work_queue_specify_password_file( struct work_queue *q, const char *file );
00467 
00472 void work_queue_specify_keepalive_interval(struct work_queue *q, int interval);
00473 
00478 void work_queue_specify_keepalive_timeout(struct work_queue *q, int timeout);
00479 
00480 
00494 int work_queue_tune(struct work_queue *q, const char *name, double value);
00495 
00497 
00501 
00502 #define WORK_QUEUE_MASTER_MODE_STANDALONE 0 
00503 #define WORK_QUEUE_MASTER_MODE_CATALOG 1    
00511 void work_queue_specify_master_mode(struct work_queue *q, int mode);
00512 
00521 int work_queue_task_specify_input_buf(struct work_queue_task *t, const char *buf, int length, const char *rname);
00522 
00530 int work_queue_task_specify_input_file(struct work_queue_task *t, const char *fname, const char *rname);
00531 
00539 int work_queue_task_specify_input_file_do_not_cache(struct work_queue_task *t, const char *fname, const char *rname);
00540 
00548 int work_queue_task_specify_output_file(struct work_queue_task *t, const char *rname, const char *fname);
00549 
00557 int work_queue_task_specify_output_file_do_not_cache(struct work_queue_task *t, const char *rname, const char *fname);
00558 
00560 
00561 #endif

Generated on 10 Oct 2013 for cctools by  doxygen 1.6.1