00001
00002
00003
00004
00005
00006
00007
00008 #ifndef BATCH_JOB_H
00009 #define BATCH_JOB_H
00010
00011 #include <time.h>
00012
00021 typedef int batch_job_id_t;
00022
00024 typedef enum {
00025 BATCH_QUEUE_TYPE_UNKNOWN=-1,
00026 BATCH_QUEUE_TYPE_LOCAL,
00027 BATCH_QUEUE_TYPE_CONDOR,
00028 BATCH_QUEUE_TYPE_SGE,
00029 BATCH_QUEUE_TYPE_WORK_QUEUE,
00030 BATCH_QUEUE_TYPE_XGRID,
00031 BATCH_QUEUE_TYPE_HADOOP
00032 } batch_queue_type_t;
00033
00035 struct batch_job_info {
00036 time_t submitted;
00037 time_t started;
00038 time_t finished;
00039 int exited_normally;
00040 int exit_code;
00041 int exit_signal;
00042 };
00043
00048 struct batch_queue * batch_queue_create( batch_queue_type_t type );
00049
00058 batch_job_id_t batch_job_submit_simple(
00059 struct batch_queue *q,
00060 const char *cmdline,
00061 const char *input_files,
00062 const char *output_files );
00063
00076 batch_job_id_t batch_job_submit(
00077 struct batch_queue *q,
00078 const char *cmd,
00079 const char *args,
00080 const char *infile,
00081 const char *outfile,
00082 const char *errfile,
00083 const char *extra_input_files,
00084 const char *extra_output_files );
00085
00095 batch_job_id_t batch_job_wait( struct batch_queue *q, struct batch_job_info *info );
00096
00108 batch_job_id_t batch_job_wait_timeout( struct batch_queue *q, struct batch_job_info *info, time_t stoptime );
00109
00118 int batch_job_remove( struct batch_queue *q, batch_job_id_t jobid );
00119
00124 batch_queue_type_t batch_queue_type_from_string( const char *str );
00125
00130 const char * batch_queue_type_to_string( batch_queue_type_t t );
00131
00138 void batch_queue_set_logfile( struct batch_queue *q, const char *logfile );
00139
00151 void batch_queue_set_options( struct batch_queue *q, const char *options );
00152
00160 void batch_queue_delete( struct batch_queue *q );
00161
00167 const char * batch_queue_type_string();
00168
00174 int batch_queue_port( struct batch_queue *q );
00175
00176 #endif