Template engine for transforming input job template into JSON job store. More...
Public Member Functions | |
__init__ (self, template_file=None, output_file='jobs.json') | |
add_input_files (self, key, file_list, nreads=1) | |
Add new input files to dict of input files. | |
add_itervar (self, name, vals) | |
Add new iteration variable to dict of iteration variables. | |
add_itervars (self, iter_dict) | |
Add several iter variables at once. | |
add_itervars_json (self, json_file) | |
Add iter variables from json file. | |
get_itervars (self) | |
Return all combinations of the iteration variables. | |
run (self) | |
Generate the JSON jobs from processing the template and write to file. | |
parse_args (self) | |
Parse arguments for template engine. | |
Public Attributes | |
template_file | |
template file from which parameters are read | |
env | |
job_id_start | |
start ID for jobs | |
input_files | |
dict of input files | |
itervars | |
dict of iteration variables | |
output_file | |
name of output file | |
template | |
max_jobs | |
repeat | |
json_template_file | |
Protected Member Functions | |
_get_max_iterations (self) | |
Get the maximum number of iterations based on file input parameters. | |
_create_jobs (self) | |
_read_input_file_list (self, input_file_list) | |
Read the input file list from arg parsing. | |
Template engine for transforming input job template into JSON job store.
Accepts a set of iteration variables of which all combinations will be turned into jobs. Also accepts lists of input files with a unique key from which one or more can be read per job. The user's template should be a JSON dict with jinja2 markup.
Definition at line 98 of file job_template.py.
__init__ | ( | self, | |
template_file = None , |
|||
output_file = 'jobs.json' |
|||
) |
Definition at line 107 of file job_template.py.
|
protected |
Definition at line 210 of file job_template.py.
|
protected |
Get the maximum number of iterations based on file input parameters.
Definition at line 197 of file job_template.py.
|
protected |
Read the input file list from arg parsing.
Definition at line 254 of file job_template.py.
add_input_files | ( | self, | |
key, | |||
file_list, | |||
nreads = 1 |
|||
) |
Add new input files to dict of input files.
key | key under which new input files are added |
file_list | list of new input files to be added |
nreads | nbr of times the input files are read |
Definition at line 127 of file job_template.py.
add_itervar | ( | self, | |
name, | |||
vals | |||
) |
Add new iteration variable to dict of iteration variables.
name | name of new variable |
vals | list of values for iteration variable |
Definition at line 137 of file job_template.py.
add_itervars | ( | self, | |
iter_dict | |||
) |
Add several iter variables at once.
iter_dict | new dict of iteration variables to be added |
Definition at line 146 of file job_template.py.
add_itervars_json | ( | self, | |
json_file | |||
) |
Add iter variables from json file.
json_file | name of json file |
Definition at line 153 of file job_template.py.
get_itervars | ( | self | ) |
Return all combinations of the iteration variables.
Definition at line 159 of file job_template.py.
parse_args | ( | self | ) |
Parse arguments for template engine.
Definition at line 272 of file job_template.py.
run | ( | self | ) |
Generate the JSON jobs from processing the template and write to file.
Definition at line 172 of file job_template.py.
env |
Definition at line 110 of file job_template.py.
input_files |
dict of input files
Definition at line 121 of file job_template.py.
itervars |
dict of iteration variables
Definition at line 123 of file job_template.py.
job_id_start |
start ID for jobs
Definition at line 119 of file job_template.py.
json_template_file |
Definition at line 295 of file job_template.py.
max_jobs |
Definition at line 248 of file job_template.py.
output_file |
name of output file
Definition at line 125 of file job_template.py.
repeat |
Definition at line 289 of file job_template.py.
template |
Definition at line 176 of file job_template.py.
template_file |
template file from which parameters are read
Definition at line 109 of file job_template.py.