-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for importing packed files #71
Comments
Hey @alexiswl ; can you put an example packed workflow that exhibits this issue on https://gist.github.com/ or similar and drop the link here? |
@alexiswl FYI, that file has |
Hi @mr-c, do you know why this might be? The raw yaml is now publicly accessible at https://github.com/umccr/cwl-ica/blob/main/workflows/bcl-conversion/3.7.5/bcl-conversion__3.7.5.cwl None of the schemas present have the
At the moment, in order to import these workflows that contain schemas through the CWL parser, I have to first import the schema object and then manually append the schema object to the namespace. See: For packed cwl files this would be a little more difficult for I need to first find the I guess something like so would be a possible way to grab the schemas required for the workflow.
Where the Still, it nonetheless seems quite hacky that this is a requirement. |
@alexiswl As you can see, your helpful example has launched many fixed to Ultimately (when all is done, merged, and released) the answer to your question will be "Load the packed document like any other." :-) FYI, here is my variation on your testing script """
Import a cwl file as a parser object
"""
import sys
from pathlib import Path
from schema_salad.utils import yaml_no_ts
# ^^ requires schema_salad >= 8.2
# does preserve_quotes=True and more
# Set path
cwl_file_path = Path(sys.argv[1])
# Load file as yaml dict
# Read in the cwl file from a json/yaml
with open(cwl_file_path, "r") as cwl_h:
cwl_file_yaml = yaml_no_ts().load(cwl_h)
# Conditional import based on cwl version
if 'cwlVersion' not in cwl_file_yaml:
print("Error - could not get the cwlVersion")
sys.exit(1)
# Import parser based on CWL Version
if cwl_file_yaml['cwlVersion'] == 'v1.0':
from cwl_utils import parser_v1_0 as parser
elif cwl_file_yaml['cwlVersion'] == 'v1.1':
from cwl_utils import parser_v1_1 as parser
elif cwl_file_yaml['cwlVersion'] == 'v1.2':
from cwl_utils import parser_v1_2 as parser
else:
print("Version error. Did not recognise {} as a CWL version".format(yaml_obj["CWLVersion"]))
sys.exit(1)
doc = parser.load_document_by_yaml(cwl_file_yaml, cwl_file_path.absolute().as_uri()) |
As per schema-salad v1.x, $namespaces are only valid in the root document: https://www.commonwl.org/v1.0/SchemaSalad.html#Explicit_context https://www.commonwl.org/v1.1/SchemaSalad.html#Explicit_context (same as v1.0) https://www.commonwl.org/v1.2/SchemaSalad.html#Explicit_context (same as v1.0, v1.1) Inspired by (and partial fix for) common-workflow-language/cwl-utils#71 (comment)
Thanks for this @mr-c! I appreciate the feedback and very happy to know that this has fixed multiple parts! Do you recommend the Is the only difference the loading of timestamps? |
Correct. Probably not needed in your case |
@alexiswl Can you try packing with https://github.com/rabix/sbpack ? |
Thanks for the suggestion @mr-c, looks like this would handle most of the workarounds we're currently doing. Is there a 'local-only' functionality of this tool / a way to import a local packed file? We don't use the Seven Bridges endpoint. |
Oh, I should have been more specific! It includes a local only tool named |
Hello,
Been playing around with how to import a packed cwl json file as a CWL parser object.
Here are my steps so far
Setup
First attempt:
Second attempt
Third attempt
Fourth attempt
Is this due to my workflow being a little bit too complicated for the parser and using record schemas?
The text was updated successfully, but these errors were encountered: