cctools
batch_job.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef BATCH_JOB_H
9 #define BATCH_JOB_H
10 
11 #include <sys/stat.h>
12 
13 #include <inttypes.h>
14 #include <stdint.h>
15 #include <time.h>
16 
17 #include "nvpair.h"
18 
27 typedef int64_t batch_job_id_t;
28 #define PRIbjid PRId64
29 #define SCNbjid SCNd64
30 
32 /* Must be kept in sync with batch_job_subsystems. */
33 typedef enum {
45 
48  time_t submitted;
49  time_t started;
50  time_t finished;
52  int exit_code;
54 };
55 
61 
70 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 );
71 
81 
92 batch_job_id_t batch_job_wait_timeout(struct batch_queue *q, struct batch_job_info *info, time_t stoptime);
93 
101 int batch_job_remove(struct batch_queue *q, batch_job_id_t jobid);
102 
103 int batch_fs_chdir (struct batch_queue *q, const char *path);
104 int batch_fs_getcwd (struct batch_queue *q, char *buf, size_t size);
105 int batch_fs_mkdir (struct batch_queue *q, const char *path, mode_t mode, int recursive);
106 int batch_fs_putfile (struct batch_queue *q, const char *lpath, const char *rpath);
107 int batch_fs_stat (struct batch_queue *q, const char *path, struct stat *buf);
108 int batch_fs_unlink (struct batch_queue *q, const char *path);
109 
115 
121 
128 void batch_queue_set_logfile(struct batch_queue *q, const char *logfile);
129 
142 void batch_queue_set_option(struct batch_queue *q, const char *what, const char *value);
143 
151 const char *batch_queue_get_option(struct batch_queue *q, const char *what);
152 
159 
167 void batch_queue_delete(struct batch_queue *q);
168 
173 const char *batch_queue_type_string();
174 
179 int batch_queue_port(struct batch_queue *q);
180 
181 #endif
batch_queue_type_t batch_queue_type_from_string(const char *str)
Converts a string into a batch queue type.
void batch_queue_delete(struct batch_queue *q)
Delete a batch queue.
int batch_job_remove(struct batch_queue *q, batch_job_id_t jobid)
Remove a batch job.
struct batch_queue * batch_queue_create(batch_queue_type_t type)
Create a new batch queue.
batch_job_id_t batch_job_wait_timeout(struct batch_queue *q, struct batch_job_info *info, time_t stoptime)
Wait for any batch job to complete, with a timeout.
batch_queue_type_t batch_queue_get_type(struct batch_queue *q)
Get batch queue type.
int64_t batch_job_id_t
An integer type indicating a unique batch job number.
Definition: batch_job.h:27
Batch jobs will be sent to the Work Queue.
Definition: batch_job.h:40
time_t started
Time the job actually began executing.
Definition: batch_job.h:49
Batch jobs will be sent to Chirp.
Definition: batch_job.h:42
Batch jobs will be sent to the Moab Workload Manager.
Definition: batch_job.h:37
void batch_queue_set_option(struct batch_queue *q, const char *what, const char *value)
Add extra options to pass to the underlying batch system.
Batch jobs will be sent to Sun Grid Engine.
Definition: batch_job.h:36
int exit_code
The result code of the job, if it exited normally.
Definition: batch_job.h:52
const char * batch_queue_type_to_string(batch_queue_type_t t)
Converts a batch queue type to a string.
void batch_queue_set_logfile(struct batch_queue *q, const char *logfile)
Set the log file used by the batch queue.
batch_queue_type_t
Indicates which type of batch submission to use.
Definition: batch_job.h:33
Batch jobs will be sent to Hadoop.
Definition: batch_job.h:41
time_t finished
Time at which the job actually completed.
Definition: batch_job.h:50
batch_job_id_t batch_job_wait(struct batch_queue *q, struct batch_job_info *info)
Wait for any batch job to complete.
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)
Submit a batch job.
int exit_signal
The signal by which the job was killed, if it exited abnormally.
Definition: batch_job.h:53
Batch jobs will be sent to a user-defined cluster manager.
Definition: batch_job.h:39
time_t submitted
Time the job was submitted to the system.
Definition: batch_job.h:48
const char * batch_queue_type_string()
Returns the list of queue types supported by this module.
An nvpair object is a collection of name-value pairs that might describe a complex object such as a h...
An invalid batch queue type.
Definition: batch_job.h:43
Definition: nvpair_private.h:15
Definition: batch_job_internal.h:43
const char * batch_queue_get_option(struct batch_queue *q, const char *what)
Get batch queue options.
Batch jobs will be sent to Condor pool.
Definition: batch_job.h:35
int batch_queue_port(struct batch_queue *q)
Returns the port number of the batch queue.
Describes a batch job when it has completed.
Definition: batch_job.h:47
int exited_normally
Non-zero if the job ran to completion, zero otherwise.
Definition: batch_job.h:51
Batch jobs will run as local processes.
Definition: batch_job.h:34
Batch jobs will be send to the Torque Scheduler.
Definition: batch_job.h:38