Template engine for transforming input job template into JSON job store. More...
Public Member Functions | |
def | __init__ (self, template_file=None, output_file='jobs.json') |
def | add_input_files (self, key, file_list, nreads=1) |
Add new input files to dict of input files. More... | |
def | add_itervar (self, name, vals) |
Add new iteration variable to dict of iteration variables. More... | |
def | add_itervars (self, iter_dict) |
Add several iter variables at once. More... | |
def | add_itervars_json (self, json_file) |
Add iter variables from json file. More... | |
def | get_itervars (self) |
Return all combinations of the iteration variables. More... | |
def | run (self) |
Generate the JSON jobs from processing the template and write to file. More... | |
def | parse_args (self) |
Parse arguments for template engine. More... | |
Public Attributes | |
template_file | |
template file from which parameters are read More... | |
env | |
job_id_start | |
start ID for jobs More... | |
input_files | |
dict of input files More... | |
itervars | |
dict of iteration variables More... | |
output_file | |
name of output file More... | |
template | |
repeat | |
max_jobs | |
Private Member Functions | |
def | _get_max_iterations (self) |
Get the maximum number of iterations based on file input parameters. More... | |
def | _create_jobs (self) |
def | _read_input_file_list (self, input_file_list) |
Read the input file list from arg parsing. More... | |
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.
def __init__ | ( | self, | |
template_file = None , |
|||
output_file = 'jobs.json' |
|||
) |
Definition at line 107 of file job_template.py.
|
private |
Definition at line 210 of file job_template.py.
|
private |
Get the maximum number of iterations based on file input parameters.
Definition at line 197 of file job_template.py.
|
private |
Read the input file list from arg parsing.
Definition at line 254 of file job_template.py.
def 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.
def 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.
def 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.
def 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.
def get_itervars | ( | self | ) |
Return all combinations of the iteration variables.
Definition at line 159 of file job_template.py.
def parse_args | ( | self | ) |
Parse arguments for template engine.
Definition at line 272 of file job_template.py.
def 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.
max_jobs |
Definition at line 291 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.