cctools
batch_job.h
Go to the documentation of this file.
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_TASK_H
8 #define BATCH_TASK_H
9 
10 #include "list.h"
11 #include "jx.h"
12 #include "rmsummary.h"
13 
23 struct batch_queue;
24 struct batch_file;
25 
27 struct batch_job {
28  int taskid;
29  int jobid;
30  struct batch_queue *queue;
31  char *command;
32  struct list *input_files;
33  struct list *output_files;
34  struct rmsummary *resources;
35  struct jx *envlist;
36  struct batch_job_info *info;
37  char *hash;
38 };
39 
45 
50 void batch_job_delete(struct batch_job *t);
51 
61 struct batch_file * batch_job_add_input_file(struct batch_job *task, const char * outer_name, const char * inner_name);
62 
72 struct batch_file * batch_job_add_output_file(struct batch_job *task, const char * outer_name, const char * inner_name);
73 
79 void batch_job_set_command(struct batch_job *t, const char *command);
80 
87 void batch_job_set_command_spec(struct batch_job *t, struct jx *command);
88 
96 void batch_job_wrap_command(struct batch_job *t, const char *command);
97 
103 void batch_job_set_resources(struct batch_job *t, const struct rmsummary *resources);
104 
110 void batch_job_set_envlist(struct batch_job *t, struct jx *envlist);
111 
117 void batch_job_set_info(struct batch_job *t, struct batch_job_info *info);
118 
125 char * batch_job_generate_id(struct batch_job *t);
126 
127 #endif
128 /* vim: set noexpandtab tabstop=8: */
batch_job::info
struct batch_job_info * info
Stores the info struct created by batch_queue.
Definition: batch_job.h:36
batch_job_set_envlist
void batch_job_set_envlist(struct batch_job *t, struct jx *envlist)
Set the envlist for this task.
jx.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
batch_job_set_info
void batch_job_set_info(struct batch_job *t, struct batch_job_info *info)
Set the batch_job_info of this task.
batch_job::command
char * command
The command line to execute.
Definition: batch_job.h:31
batch_job::queue
struct batch_queue * queue
The queue this task is assigned to.
Definition: batch_job.h:30
batch_job_add_output_file
struct batch_file * batch_job_add_output_file(struct batch_job *task, const char *outer_name, const char *inner_name)
Add file to output list of batch_job Creates a new batch_file from outer_name and inner_name.
batch_job::output_files
struct list * output_files
Task's expected outputs, type batch_file.
Definition: batch_job.h:33
batch_job::taskid
int taskid
Indicates the id provided by the creating system.
Definition: batch_job.h:28
batch_file::inner_name
char * inner_name
The name of the file as it should appear to the running job.
Definition: batch_file.h:30
batch_job_create
struct batch_job * batch_job_create(struct batch_queue *queue)
Create a batch_job struct.
batch_job_set_command
void batch_job_set_command(struct batch_job *t, const char *command)
Set the command of the batch_job.
batch_job_generate_id
char * batch_job_generate_id(struct batch_job *t)
Generate a sha1 hash based on the specified task.
batch_job::jobid
int jobid
Indicates the id assigned to the job by the submission system.
Definition: batch_job.h:29
batch_job_set_command_spec
void batch_job_set_command_spec(struct batch_job *t, struct jx *command)
Set the batch task's command to the given JX command spec.
batch_job_add_input_file
struct batch_file * batch_job_add_input_file(struct batch_job *task, const char *outer_name, const char *inner_name)
Add file to input list of batch_job Creates a new batch_file from outer_name and inner_name.
batch_job::envlist
struct jx * envlist
JSON formatted environment list.
Definition: batch_job.h:35
rmsummary
Definition: rmsummary.h:26
batch_job::resources
struct rmsummary * resources
Resources assigned to task.
Definition: batch_job.h:34
batch_file
Internal description of a single file used by a batch job.
Definition: batch_file.h:28
list.h
batch_job_info
Describes a batch job when it has completed.
Definition: batch_job_info.h:13
batch_job::input_files
struct list * input_files
Task's required inputs, type batch_file.
Definition: batch_job.h:32
jx
JX value representing any expression type.
Definition: jx.h:117
batch_job_delete
void batch_job_delete(struct batch_job *t)
Delete a batch_job struct.
batch_job_wrap_command
void batch_job_wrap_command(struct batch_job *t, const char *command)
Wrap the existing command with a template string.
batch_file::outer_name
char * outer_name
The name of the file in the submitters filesystem namespace.
Definition: batch_file.h:29
batch_job_set_resources
void batch_job_set_resources(struct batch_job *t, const struct rmsummary *resources)
Set the resources needed for task.
batch_job::hash
char * hash
Checksum based on CMD, input contents, and output names.
Definition: batch_job.h:37