cctools
batch_job.h
Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
00003 Copyright (C) 2005- The University of Notre Dame
00004 This software is distributed under the GNU General Public License.
00005 See the file COPYING for details.
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_MOAB,                
00030         BATCH_QUEUE_TYPE_CLUSTER,                
00031         BATCH_QUEUE_TYPE_WORK_QUEUE,          
00032         BATCH_QUEUE_TYPE_WORK_QUEUE_SHAREDFS, 
00033         BATCH_QUEUE_TYPE_XGRID,               
00034         BATCH_QUEUE_TYPE_HADOOP,              
00035         BATCH_QUEUE_TYPE_MPI_QUEUE            
00036 } batch_queue_type_t;
00037 
00039 struct batch_job_info {
00040         time_t submitted;       
00041         time_t started;         
00042         time_t finished;        
00043         int exited_normally;    
00044         int exit_code;          
00045         int exit_signal;        
00046 };
00047 
00052 struct batch_queue *batch_queue_create(batch_queue_type_t type);
00053 
00062 batch_job_id_t batch_job_submit_simple(struct batch_queue *q, const char *cmdline, const char *input_files, const char *output_files);
00063 
00076 batch_job_id_t batch_job_submit(struct batch_queue *q, const char *cmd, const char *args, const char *infile, const char *outfile, const char *errfile, const char *extra_input_files, const char *extra_output_files);
00077 
00087 batch_job_id_t batch_job_wait(struct batch_queue *q, struct batch_job_info *info);
00088 
00100 batch_job_id_t batch_job_wait_timeout(struct batch_queue *q, struct batch_job_info *info, time_t stoptime);
00101 
00110 int batch_job_remove(struct batch_queue *q, batch_job_id_t jobid);
00111 
00116 batch_queue_type_t batch_queue_type_from_string(const char *str);
00117 
00122 const char *batch_queue_type_to_string(batch_queue_type_t t);
00123 
00130 void batch_queue_set_logfile(struct batch_queue *q, const char *logfile);
00131 
00143 void batch_queue_set_options(struct batch_queue *q, const char *options);
00144 
00152 void batch_queue_delete(struct batch_queue *q);
00153 
00159 const char *batch_queue_type_string();
00160 
00166 int batch_queue_port(struct batch_queue *q);
00167 
00168 #endif