00001 #ifndef WORK_QUEUE_H 00002 #define WORK_QUEUE_H 00003 00014 #include "timestamp.h" 00015 00016 #define WORK_QUEUE_LINE_MAX 1024 00017 00018 00020 struct task_file { 00021 short fname_or_literal; //0 or 1 00022 int length; 00023 void* payload; 00024 char* remote_name; 00025 }; 00026 00029 struct work_queue_task { 00030 char *tag; 00031 char *command; 00032 char *output; 00033 struct task_file* input_files; 00034 int num_inputs; 00035 char *output_files; 00036 int result; 00037 int taskid; 00038 int priority; 00039 char host[32]; 00040 timestamp_t start_time; 00041 timestamp_t finish_time; 00042 int total_bytes_transfered; 00043 timestamp_t total_transfer_time; 00044 }; 00045 00048 struct work_queue_stats { 00049 int workers_init; 00050 int workers_ready; 00051 int workers_busy; 00052 int tasks_running; 00053 int tasks_waiting; 00054 int tasks_complete; 00055 int total_tasks_dispatched; 00056 int total_tasks_complete; 00057 int total_workers_joined; 00058 int total_workers_removed; 00059 }; 00060 00065 struct work_queue * work_queue_create( int port ); 00066 00070 void work_queue_delete( struct work_queue *q ); 00071 00076 void work_queue_submit( struct work_queue *q, struct work_queue_task *t ); 00077 00082 struct work_queue_task * work_queue_wait( struct work_queue *q ); 00083 00088 struct work_queue_task * work_queue_wait_time( struct work_queue *q , time_t stoptime); 00089 00097 struct work_queue_task * work_queue_task_create( const char *tag, const char *command, const struct task_file *input_files, const int num_inputs, const char *output_files, int priority ); 00098 00102 void work_queue_task_delete( struct work_queue_task *t ); 00103 00108 void work_queue_get_stats( struct work_queue *q, struct work_queue_stats *s ); 00109 00110 #endif