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 };
00088 
00091 struct work_queue_stats {
00092         int port;
00093         int priority;
00094         int workers_init;               
00095         int workers_ready;              
00096         int workers_busy;               
00097         int workers_full;               
00098         int tasks_running;              
00099         int tasks_waiting;              
00100         int tasks_complete;             
00101         int total_tasks_dispatched;     
00102         int total_tasks_complete;       
00103         int total_workers_joined;       
00104         int total_workers_removed;      
00105         INT64_T total_bytes_sent;       
00106         INT64_T total_bytes_received;   
00107         timestamp_t start_time;         
00108         timestamp_t total_send_time;    
00109         timestamp_t total_receive_time; 
00110         double efficiency;
00111         double idle_percentage;
00112         int capacity;
00113         int avg_capacity;
00114         int total_workers_connected;
00115         int total_worker_slots;                 
00116 };
00117 
00118 
00122 
00130 struct work_queue_task *work_queue_task_create(const char *full_command);
00131 
00136 void work_queue_task_specify_command( struct work_queue_task *t, const char *cmd );
00137 
00150 int work_queue_task_specify_file(struct work_queue_task *t, const char *local_name, const char *remote_name, int type, int flags);
00151 
00166 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);
00167 
00178 int work_queue_task_specify_buffer(struct work_queue_task *t, const char *data, int length, const char *remote_name, int flags);
00179 
00193 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);
00194 
00200 void work_queue_task_specify_memory( struct work_queue_task *t, int memory );
00201 
00207 void work_queue_task_specify_disk( struct work_queue_task *t, int disk );
00208 
00214 void work_queue_task_specify_cores( struct work_queue_task *t, int cores );
00215 
00222 void work_queue_task_specify_tag(struct work_queue_task *t, const char *tag);
00223 
00233 void work_queue_task_specify_algorithm(struct work_queue_task *t, int algo );
00234 
00239 void work_queue_task_delete(struct work_queue_task *t);
00240 
00242 
00246 
00263 struct work_queue *work_queue_create(int port);
00264 
00272 int work_queue_enable_monitoring(struct work_queue *q, char *monitor_summary_file);
00273 
00282 int work_queue_submit(struct work_queue *q, struct work_queue_task *t);
00283 
00298 struct work_queue_task *work_queue_wait(struct work_queue *q, int timeout);
00299 
00311 int work_queue_hungry(struct work_queue *q);
00312 
00320 int work_queue_empty(struct work_queue *q);
00321 
00328 int work_queue_port(struct work_queue *q);
00329 
00334 void work_queue_get_stats(struct work_queue *q, struct work_queue_stats *s);
00335 
00342 char * work_queue_get_worker_summary( struct work_queue *q );
00343 
00349 int work_queue_activate_fast_abort(struct work_queue *q, double multiplier);
00350 
00362 void work_queue_specify_algorithm(struct work_queue *q, int algo);
00363 
00373 void work_queue_specify_task_order(struct work_queue *q, int order);
00374 
00379 const char *work_queue_name(struct work_queue *q);
00380 
00385 void work_queue_specify_name(struct work_queue *q, const char *name);
00386 
00391 void work_queue_specify_priority(struct work_queue *q, int priority);
00392 
00397 void work_queue_specify_estimate_capacity_on(struct work_queue *q, int estimate_capacity_on);
00398 
00404 void work_queue_specify_catalog_server(struct work_queue *q, const char *hostname, int port);
00405 
00411 struct work_queue_task *work_queue_cancel_by_taskid(struct work_queue *q, int id);
00412 
00418 struct work_queue_task *work_queue_cancel_by_tasktag(struct work_queue *q, const char *tag);
00419 
00424 struct list * work_queue_cancel_all_tasks(struct work_queue *q);
00425 
00432 void work_queue_reset(struct work_queue *q, int flags);
00433 
00438 int work_queue_shut_down_workers(struct work_queue *q, int n);
00439 
00444 void work_queue_delete(struct work_queue *q);
00445 
00450 void work_queue_specify_log(struct work_queue *q, const char *logfile);
00451 
00457 void work_queue_specify_password( struct work_queue *q, const char *password );
00458 
00465 int work_queue_specify_password_file( struct work_queue *q, const char *file );
00466 
00471 void work_queue_specify_keepalive_interval(struct work_queue *q, int interval);
00472 
00477 void work_queue_specify_keepalive_timeout(struct work_queue *q, int timeout);
00478 
00479 
00493 int work_queue_tune(struct work_queue *q, const char *name, double value);
00494 
00496 
00500 
00501 #define WORK_QUEUE_MASTER_MODE_STANDALONE 0 
00502 #define WORK_QUEUE_MASTER_MODE_CATALOG 1    
00510 void work_queue_specify_master_mode(struct work_queue *q, int mode);
00511 
00520 int work_queue_task_specify_input_buf(struct work_queue_task *t, const char *buf, int length, const char *rname);
00521 
00529 int work_queue_task_specify_input_file(struct work_queue_task *t, const char *fname, const char *rname);
00530 
00538 int work_queue_task_specify_input_file_do_not_cache(struct work_queue_task *t, const char *fname, const char *rname);
00539 
00547 int work_queue_task_specify_output_file(struct work_queue_task *t, const char *rname, const char *fname);
00548 
00556 int work_queue_task_specify_output_file_do_not_cache(struct work_queue_task *t, const char *rname, const char *fname);
00557 
00559 
00560 #endif

Generated on 30 Jul 2013 for cctools by  doxygen 1.6.1