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 "timestamp.h"
00021 
00022 #define WORK_QUEUE_DEFAULT_PORT 9123
00023 #define WORK_QUEUE_LINE_MAX 1024
00024 
00025 #define WORK_QUEUE_WAITFORTASK -1
00026 
00027 #define WORK_QUEUE_RESULT_UNSET 0
00028 #define WORK_QUEUE_RESULT_INPUT_FAIL 1
00029 #define WORK_QUEUE_RESULT_FUNCTION_FAIL 2
00030 #define WORK_QUEUE_RESULT_OUTPUT_FAIL 3
00031 #define WORK_QUEUE_RESULT_LINK_FAIL 4
00032 
00033 #define WORK_QUEUE_SCHEDULE_UNSET 0 // default setting for task.
00034 #define WORK_QUEUE_SCHEDULE_FCFS 1
00035 #define WORK_QUEUE_SCHEDULE_FILES 2
00036 #define WORK_QUEUE_SCHEDULE_TIME 3
00037 #define WORK_QUEUE_SCHEDULE_MAX 3
00038 #define WORK_QUEUE_SCHEDULE_DEFAULT 3 // default setting for queue.
00039 
00040 #define WORK_QUEUE_INPUT  0
00041 #define WORK_QUEUE_OUTPUT 1
00042 
00043 #define WORK_QUEUE_NOCACHE 0
00044 #define WORK_QUEUE_CACHE 1
00045 
00046 extern double wq_option_fast_abort_multiplier; 
00047 extern int wq_option_scheduler; 
00051 struct work_queue_task {
00052         char *tag;                      
00053         char *command_line;             
00054         int worker_selection_algorithm;           
00055         char *output;                   
00056         struct list * input_files;      
00057         struct list * output_files;     
00058         int taskid;                     
00059         int return_status;              
00060         int result;                     
00061         char* host;                     
00062         timestamp_t submit_time;        
00063         timestamp_t start_time;         
00064         timestamp_t finish_time;        
00065     INT64_T total_bytes_transfered;
00066         timestamp_t total_transfer_time;
00067 };
00068 
00071 struct work_queue_stats {
00072         int workers_init;               
00073         int workers_ready;              
00074         int workers_busy;               
00075         int tasks_running;              
00076         int tasks_waiting;              
00077         int tasks_complete;             
00078         int total_tasks_dispatched;     
00079         int total_tasks_complete;       
00080         int total_workers_joined;       
00081         int total_workers_removed;      
00082         INT64_T total_bytes_sent;       
00083         INT64_T total_bytes_received;   
00084 };
00085 
00089 
00093 struct work_queue_task * work_queue_task_create( const char *full_command);
00094 
00105 void work_queue_task_specify_file( struct work_queue_task *t, const char *local_name, const char *remote_name, int type, int flags );
00106 
00114 void work_queue_task_specify_buffer( struct work_queue_task *t, const char *data, int length, const char *remote_name, int flags );
00115 
00121 void work_queue_task_specify_tag( struct work_queue_task *t, const char *tag );
00122 
00127 int work_queue_task_specify_algorithm( struct work_queue_task *t, int alg );
00128 
00132 void work_queue_task_delete( struct work_queue_task *t );
00133 
00135 
00139 
00156 struct work_queue * work_queue_create( int port );
00157 
00163 void work_queue_submit( struct work_queue *q, struct work_queue_task *t );
00164 
00170 struct work_queue_task * work_queue_wait( struct work_queue *q, int timeout );
00171 
00175 int work_queue_hungry (struct work_queue *q);
00176 
00180 int work_queue_empty (struct work_queue *q);
00181 
00186 int work_queue_port( struct work_queue *q );
00187 
00192 void work_queue_get_stats( struct work_queue *q, struct work_queue_stats *s );
00193 
00199 int work_queue_activate_fast_abort(struct work_queue* q, double multiplier );
00200 
00205 int work_queue_specify_algorithm( struct work_queue* q, int alg );
00206 
00211 int work_queue_specify_name( struct work_queue* q, const char *name );
00212 
00217 int work_queue_shut_down_workers (struct work_queue *q, int n);
00218 
00222 void work_queue_delete( struct work_queue *q );
00223 
00225 
00229 
00237 void work_queue_task_specify_input_buf( struct work_queue_task *t, const char *buf, int length, const char *rname);
00238 
00245 void work_queue_task_specify_input_file( struct work_queue_task *t, const char *fname, const char *rname);
00246 
00253 void work_queue_task_specify_input_file_do_not_cache( struct work_queue_task *t, const char *fname, const char *rname);
00254 
00261 void work_queue_task_specify_output_file( struct work_queue_task *t, const char *rname, const char *fname);
00262 
00269 void work_queue_task_specify_output_file_do_not_cache( struct work_queue_task* t, const char* rname, const char* fname);
00270 
00272 
00273 #endif

Generated on Mon Oct 18 08:38:06 2010 for cctools by  doxygen 1.4.7