12 cwd = os.path.join(os.getcwd(),
"json_data")
13 if not os.path.exists(cwd):
17 for f
in os.listdir(cwd):
18 full_path = os.path.join(cwd, f)
19 if os.path.isfile(full_path)
and f.endswith(
".json"):
20 json_files.append(full_path)
29 int_runs.append(int(item))
31 print "WARNING: run is in bad format: {0}".
format(run)
35 """ Recursively converts dictionary keys to strings.
36 Utility to help deal with unicode keys in dictionaries created from json requests.
37 In order to pass dict to function as **kwarg we should transform key/value to str.
39 if isinstance(dictionary, basestring):
40 return str(dictionary)
41 elif isinstance(dictionary, collections.Mapping):
42 return dict(map(convert_keys_to_string, dictionary.iteritems()))
43 elif isinstance(dictionary, collections.Iterable):
44 return type(dictionary)(map(convert_keys_to_string, dictionary))
50 for index, data_file
in enumerate(data_files):
51 with open(data_file,
"r") as f:
56 for step_name, step
in data[
"steps"].
items():
57 steps_names.append((step_name, step[
"sequence_number"]))
58 if step_name
in steps:
62 if "inputInfo" in step:
63 input_info = step[
"inputInfo"]
64 if "run" in input_info:
65 input_info[
"run"] =
fix_run(input_info[
"run"])
68 'INPUT': InputInfo(**input_info)
71 elif "parameters" in step:
72 steps[step_name] = step[
"parameters"]
76 sorted_steps = sorted(steps_names, key=
lambda step: step[1])
77 sorted_steps_names = [step_name[0]
for step_name
in sorted_steps]
79 workflows[1000000.0 + 0.1*index] = [label, sorted_steps_names]
def load_steps_and_workflows
def convert_keys_to_string