Made the converter to abort and fail at the first encountered error. Garbage in, garbage out.
Luis de la Garza
6 years ago
55 | 55 |
|
56 | 56 |
- [Generation of Galaxy ToolConfig files](galaxy/README.md)
|
57 | 57 |
- [Generation of CWL task files](cwl/README.md)
|
|
58 |
|
|
59 |
## Fail Policy while processing several Files
|
|
60 |
`CTDConverter` can parse several CTDs and convert them. However, the process will be interrupted and an error code will be returned at the first encountered error (e.g., a CTD is not valid, there are missing support files, etc.).
|
58 | 61 |
|
59 | 62 |
## Converting a single CTD
|
60 | 63 |
In its simplest form, the converter takes an input CTD file and generates an output file. The following usage of `CTDConverter`:
|
104 | 104 |
error("Could not load validation schema %s. Reason: %s" % (xsd_location, str(e)), 0)
|
105 | 105 |
else:
|
106 | 106 |
warning("Validation against a schema has not been enabled.", 0)
|
|
107 |
|
107 | 108 |
for input_ctd in input_ctds:
|
108 | |
try:
|
109 | |
if schema is not None:
|
110 | |
validate_against_schema(input_ctd, schema)
|
111 | |
output_file = output_destination
|
112 | |
# if multiple inputs are being converted, we need to generate a different output_file for each input
|
113 | |
if is_converting_multiple_ctds:
|
114 | |
output_file = os.path.join(output_file,
|
115 | |
get_filename_without_suffix(input_ctd) + "." + output_file_extension)
|
116 | |
info("Parsing %s" % input_ctd)
|
117 | |
parsed_ctds.append(ParsedCTD(CTDModel(from_file=input_ctd), input_ctd, output_file))
|
118 | |
except Exception, e:
|
119 | |
error(str(e), 1)
|
120 | |
continue
|
|
109 |
if schema is not None:
|
|
110 |
validate_against_schema(input_ctd, schema)
|
|
111 |
|
|
112 |
output_file = output_destination
|
|
113 |
# if multiple inputs are being converted, we need to generate a different output_file for each input
|
|
114 |
if is_converting_multiple_ctds:
|
|
115 |
output_file = os.path.join(output_file, get_filename_without_suffix(input_ctd) + "." + output_file_extension)
|
|
116 |
info("Parsing %s" % input_ctd)
|
|
117 |
parsed_ctds.append(ParsedCTD(CTDModel(from_file=input_ctd), input_ctd, output_file))
|
|
118 |
|
121 | 119 |
return parsed_ctds
|
122 | 120 |
|
123 | 121 |
|
214 | 214 |
converter.get_preferred_file_extension())
|
215 | 215 |
|
216 | 216 |
# let the converter do its own thing
|
217 | |
return converter.convert_models(args, parsed_ctds)
|
|
217 |
converter.convert_models(args, parsed_ctds)
|
|
218 |
return 0
|
218 | 219 |
|
219 | 220 |
except KeyboardInterrupt:
|
220 | 221 |
print("Interrupted...")
|
76 | 76 |
stream.write("# Visit https://github.com/WorkflowConversion/CTDConverter for more information.\n\n")
|
77 | 77 |
yaml.dump(cwl_tool, stream, default_flow_style=False)
|
78 | 78 |
stream.close()
|
79 | |
|
80 | |
return 0
|
81 | 79 |
|
82 | 80 |
|
83 | 81 |
# returns a dictionary
|
101 | 101 |
# generate datatypes_conf.xml
|
102 | 102 |
if args.data_types_destination is not None:
|
103 | 103 |
generate_data_type_conf(supported_file_formats, args.data_types_destination)
|
104 | |
|
105 | |
return 0
|
106 | 104 |
|
107 | 105 |
|
108 | 106 |
def parse_tools_list_file(tools_list_file):
|