Open simleo opened 3 years ago
I would accept a PR to cwltool that provides a single call that does what you need :-)
I would accept a PR to cwltool that provides a single call that does what you need :-)
If you want to modify cwltool in light of this, I think it's a matter of what you would like the new semantics to be. I.e., do you think the current resolve_and_validate_document
is somehow "incomplete", in the sense that it should also include the call to make_tool
, which provides additional validation? Then the change could be something like:
diff --git a/cwltool/load_tool.py b/cwltool/load_tool.py
index 34dcf122..46bce6c4 100644
--- a/cwltool/load_tool.py
+++ b/cwltool/load_tool.py
@@ -425,8 +425,8 @@ def resolve_and_validate_document(
visit_class(
processobj, ("CommandLineTool", "Workflow", "ExpressionTool"), update_index
)
-
- return loadingContext, uri
+ tool = make_tool(uri, loadingContext)
+ return loadingContext, uri, tool
With consequent changes in all the code that uses resolve_and_validate_document
. This would be backwards incompatible though.
Or would you rather have a new function that calls resolve_and_validate_document
and then make_tool
in sequence? If so, how would you name it?
Lets call it recursive_resolve_and_validate_document
.
Another option is to use the autogenerated Python CWL parser in cwl-utils
. Though it doesn't produce identical messages as cwltool.
Specifically, compare to using cwl_utils.parser_v1_2.load_document(path)
or cwl_utils.parser_v1_2.load_document_by_string(example_string)
, that might be simpler.
Thank you @simleo ; a new cwltool
version has been released with your new function: https://github.com/common-workflow-language/cwltool/releases/tag/3.0.20201117141248
It was recently found that CWL abstract workflows generated with gxformat2 fail to validate with
cwltool --validate
(see https://github.com/ResearchObject/ro-crate-py/issues/33 for some background). However, test_export_abstract.py succeeds, despite usingcwltool.main.resolve_and_validate_document
. The reason is thatcwltool --validate
does not stop after callingresolve_and_validate_document
. In particular, it callsmake_tool
, which tries to build aWorkflow
object and triggers this validation error.To make the validation in the test as strict as
cwltool --validate
, the following change could be applied: