1 from __future__
import print_function
14 cwd = os.path.join(os.getcwd(),
"json_data")
15 if not os.path.exists(cwd):
19 for f
in os.listdir(cwd):
20 full_path = os.path.join(cwd, f)
21 if os.path.isfile(full_path)
and f.endswith(
".json"):
22 json_files.append(full_path)
31 int_runs.append(
int(item))
33 print(
"WARNING: run is in bad format: {0}".
format(run))
37 """ Recursively converts dictionary keys to strings.
38 Utility to help deal with unicode keys in dictionaries created from json requests.
39 In order to pass dict to function as **kwarg we should transform key/value to str.
41 if isinstance(dictionary, str):
42 return str(dictionary)
43 elif isinstance(dictionary, collections.Mapping):
44 return dict(
map(convert_keys_to_string, six.iteritems(dictionary)))
45 elif isinstance(dictionary, collections.Iterable):
46 return type(dictionary)(
map(convert_keys_to_string, dictionary))
52 for index, data_file
in enumerate(data_files):
53 with open(data_file,
"r")
as f:
58 for step_name, step
in data[
"steps"].
items():
59 steps_names.append((step_name, step[
"sequence_number"]))
60 if step_name
in steps:
64 if "inputInfo" in step:
65 input_info = step[
"inputInfo"]
66 if "run" in input_info:
67 input_info[
"run"] =
fix_run(input_info[
"run"])
70 'INPUT': InputInfo(**input_info)
73 elif "parameters" in step:
74 steps[step_name] = step[
"parameters"]
78 sorted_steps = sorted(steps_names, key=
lambda step: step[1])
79 sorted_steps_names = [step_name[0]
for step_name
in sorted_steps]
81 workflows[1000000.0 + 0.1*index] = [label, sorted_steps_names]