1 from __future__
import print_function
13 cwd = os.path.join(os.getcwd(),
"json_data")
14 if not os.path.exists(cwd):
18 for f
in os.listdir(cwd):
19 full_path = os.path.join(cwd, f)
20 if os.path.isfile(full_path)
and f.endswith(
".json"):
21 json_files.append(full_path)
30 int_runs.append(
int(item))
32 print(
"WARNING: run is in bad format: {0}".
format(run))
36 """ Recursively converts dictionary keys to strings. 37 Utility to help deal with unicode keys in dictionaries created from json requests. 38 In order to pass dict to function as **kwarg we should transform key/value to str. 40 if isinstance(dictionary, str):
41 return str(dictionary)
42 elif isinstance(dictionary, collections.Mapping):
43 return dict(
map(convert_keys_to_string, dictionary.items()))
44 elif isinstance(dictionary, collections.Iterable):
45 return type(dictionary)(
map(convert_keys_to_string, dictionary))
51 for index, data_file
in enumerate(data_files):
52 with open(data_file,
"r") as f: 57 for step_name, step
in data[
"steps"].
items():
58 steps_names.append((step_name, step[
"sequence_number"]))
59 if step_name
in steps:
63 if "inputInfo" in step:
64 input_info = step[
"inputInfo"]
65 if "run" in input_info:
66 input_info[
"run"] =
fix_run(input_info[
"run"])
69 'INPUT': InputInfo(**input_info)
72 elif "parameters" in step:
73 steps[step_name] = step[
"parameters"]
77 sorted_steps = sorted(steps_names, key=
lambda step: step[1])
78 sorted_steps_names = [step_name[0]
for step_name
in sorted_steps]
80 workflows[1000000.0 + 0.1*index] = [label, sorted_steps_names]
def load_steps_and_workflows()
def replace(string, replacements)
def convert_keys_to_string(dictionary)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)