cctools
batch_queue_internal.h
1 /*
2 Copyright (C) 2024 The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef BATCH_JOB_INTERNAL_H_
8 #define BATCH_JOB_INTERNAL_H_
9 
10 #include <sys/stat.h>
11 
12 #include <limits.h>
13 #include <stdlib.h>
14 
15 #include "batch_queue.h"
16 #include "copy_stream.h"
17 #include "create_dir.h"
18 #include "unlink_recursive.h"
19 #include "hash_table.h"
20 #include "itable.h"
21 
22 #define BATCH_JOB_LINE_MAX 8192
23 
25  batch_queue_type_t type;
26  char typestr[128];
27 
28  int (*create) (struct batch_queue *Q);
29  int (*free) (struct batch_queue *Q);
30  int (*port) (struct batch_queue *Q);
31  void (*option_update) (struct batch_queue *Q, const char *what, const char *value); /* called when an option is changed */
32 
33  batch_queue_id_t (*submit) (struct batch_queue *Q, struct batch_job *bt );
34  batch_queue_id_t (*wait) (struct batch_queue *Q, struct batch_job_info *info, time_t stoptime);
35  int (*remove) (struct batch_queue *Q, batch_queue_id_t id);
36 };
37 
38 struct batch_queue {
39  batch_queue_type_t type;
40 
41  char logfile[PATH_MAX];
42  struct hash_table *options;
43  struct hash_table *features;
44  struct itable *job_table;
45  struct hash_table *tv_file_table;
46  struct vine_manager *tv_manager;
47  struct work_queue *wq_manager;
48  const struct batch_queue_module *module;
49 };
50 
51 #define batch_queue_stub_create(name) static int batch_queue_##name##_create (struct batch_queue *Q) { return 0; }
52 #define batch_queue_stub_free(name) static int batch_queue_##name##_free (struct batch_queue *Q) { return 0; }
53 #define batch_queue_stub_port(name) static int batch_queue_##name##_port (struct batch_queue *Q) { return 0; }
54 #define batch_queue_stub_option_update(name) static void batch_queue_##name##_option_update (struct batch_queue *Q, const char *what, const char *value) { return; }
55 
56 #endif
57 
58 /* vim: set noexpandtab tabstop=8: */
batch_queue_module
Definition: batch_queue_internal.h:24
itable.h
batch_queue
Definition: batch_queue_internal.h:38
batch_job
Internal description of a single batch job submitted to a queue.
Definition: batch_job.h:27
create_dir.h
batch_queue.h
batch_queue_type_t
batch_queue_type_t
Indicates which type of batch submission to use.
Definition: batch_queue.h:68
batch_queue_id_t
int64_t batch_queue_id_t
An integer type indicating a unique batch job number.
Definition: batch_queue.h:62
batch_job_info
Describes a batch job when it has completed.
Definition: batch_job_info.h:13
hash_table.h