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 <sys/stat.h>
00012 
00013 #include <inttypes.h>
00014 #include <stdint.h>
00015 #include <time.h>
00016 
00017 #include "nvpair.h"
00018 
00027 typedef int64_t batch_job_id_t;
00028 #define PRIbjid  PRId64
00029 #define SCNbjid  SCNd64
00030 
00032 /* Must be kept in sync with batch_job_subsystems. */
00033 typedef enum {
00034         BATCH_QUEUE_TYPE_LOCAL,               
00035         BATCH_QUEUE_TYPE_CONDOR,              
00036         BATCH_QUEUE_TYPE_SGE,                 
00037         BATCH_QUEUE_TYPE_MOAB,                
00038         BATCH_QUEUE_TYPE_PBS,                 
00039         BATCH_QUEUE_TYPE_TORQUE,              
00040         BATCH_QUEUE_TYPE_SLURM,               
00041         BATCH_QUEUE_TYPE_CLUSTER,             
00042         BATCH_QUEUE_TYPE_WORK_QUEUE,          
00043         BATCH_QUEUE_TYPE_HADOOP,              
00044         BATCH_QUEUE_TYPE_CHIRP,               
00045         BATCH_QUEUE_TYPE_UNKNOWN = -1         
00046 } batch_queue_type_t;
00047 
00049 struct batch_job_info {
00050         time_t submitted;    
00051         time_t started;      
00052         time_t finished;     
00053         int exited_normally; 
00054         int exit_code;       
00055         int exit_signal;     
00056 };
00057 
00062 struct batch_queue *batch_queue_create(batch_queue_type_t type);
00063 
00072 batch_job_id_t batch_job_submit(struct batch_queue *q, const char *cmdline, const char *input_files, const char *output_files, struct nvpair *envlist );
00073 
00082 batch_job_id_t batch_job_wait(struct batch_queue *q, struct batch_job_info *info);
00083 
00094 batch_job_id_t batch_job_wait_timeout(struct batch_queue *q, struct batch_job_info *info, time_t stoptime);
00095 
00103 int batch_job_remove(struct batch_queue *q, batch_job_id_t jobid);
00104 
00105 int batch_fs_chdir (struct batch_queue *q, const char *path);
00106 int batch_fs_getcwd (struct batch_queue *q, char *buf, size_t size);
00107 int batch_fs_mkdir (struct batch_queue *q, const char *path, mode_t mode, int recursive);
00108 int batch_fs_putfile (struct batch_queue *q, const char *lpath, const char *rpath);
00109 int batch_fs_stat (struct batch_queue *q, const char *path, struct stat *buf);
00110 int batch_fs_unlink (struct batch_queue *q, const char *path);
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 
00144 void batch_queue_set_option(struct batch_queue *q, const char *what, const char *value);
00145 
00151 void batch_queue_set_int_option(struct batch_queue *q, const char *what, int value);
00152 
00160 const char *batch_queue_get_option(struct batch_queue *q, const char *what);
00161 
00167 batch_queue_type_t batch_queue_get_type(struct batch_queue *q);
00168 
00176 void batch_queue_delete(struct batch_queue *q);
00177 
00182 const char *batch_queue_type_string();
00183 
00188 int batch_queue_port(struct batch_queue *q);
00189 
00190 #endif

Generated on 17 Dec 2015 for cctools by  doxygen 1.6.1