-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Input format
expression not considering $namespaces
#2033
Comments
format
expression not considering $namespace
format
expression not considering $namespaces
Error on my end. If the single "FeatureCollection" Filefeatures:
class: File
path: /tmp/feature-0.geojson
format: "ogc-term:FeatureCollection" OR features:
class: File
path: /tmp/feature-0.geojson
format: "http://www.opengis.net/def/glossary/term/FeatureCollection" array of "feature" Filesfeatures:
- class: File
path: /tmp/feature-0.geojson
format: "iana:application/geo+json" OR features:
- class: File
path: /tmp/feature-0.geojson
format: "https://www.iana.org/assignments/media-types/application/geo+json" |
Further investigation reveals that this is actually still an issue. More specifically, if the input is defined with the following, everything works inputs:
features:
format: |
${
if (Array.isArray(inputs.features)) {
return "https://www.iana.org/assignments/media-types/application/geo+json";
}
return "http://www.opengis.net/def/glossary/term/FeatureCollection";
} However, if using the namespace inputs:
features:
format: |
${
if (Array.isArray(inputs.features)) {
return "iana:application/geo+json";
}
return "ogc-term:FeatureCollection";
} With the namespace
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 554, in bind_input
check_format(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwl_utils/file_formats.py", line 70, in check_format
raise ValidationException(
schema_salad.exceptions.ValidationException: File has an incompatible format: {
"class": "File",
"format": "https://www.iana.org/assignments/media-types/application/geo+json",
"location": "file:///tmp/feature-0.geojson",
"size": 162,
"basename": "feature-0.geojson",
"nameroot": "feature-0",
"nameext": ".geojson"
}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/executors.py", line 218, in run_jobs
for job in jobiter:
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/command_line_tool.py", line 963, in job
builder = self._init_job(job_order, runtimeContext)
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/process.py", line 888, in _init_job
builder.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 330, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 262, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 288, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 355, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 561, in bind_input
f"Expected value of {schema['name']!r} to have "
KeyError: 'name'
ERROR Workflow error:
'name'
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 554, in bind_input
check_format(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwl_utils/file_formats.py", line 70, in check_format
raise ValidationException(
schema_salad.exceptions.ValidationException: File has an incompatible format: {
"class": "File",
"format": "https://www.iana.org/assignments/media-types/application/geo+json",
"location": "file:///tmp/feature-0.geojson",
"size": 162,
"basename": "feature-0.geojson",
"nameroot": "feature-0",
"nameext": ".geojson"
}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/executors.py", line 218, in run_jobs
for job in jobiter:
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/command_line_tool.py", line 963, in job
builder = self._init_job(job_order, runtimeContext)
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/process.py", line 888, in _init_job
builder.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 330, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 262, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 288, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 355, in bind_input
self.bind_input(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/builder.py", line 561, in bind_input
f"Expected value of {schema['name']!r} to have "
KeyError: 'name'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/main.py", line 1298, in main
(out, status) = real_executor(
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/executors.py", line 62, in __call__
return self.execute(process, job_order_object, runtime_context, logger)
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/executors.py", line 145, in execute
self.run_jobs(process, job_order_object, logger, runtime_context)
File "/home/francis/dev/conda/envs/weaver-py310/lib/python3.10/site-packages/cwltool/executors.py", line 252, in run_jobs
raise WorkflowException(str(err)) from err
cwltool.errors.WorkflowException: 'name'
|
Expected Behavior
When using a file
format
with a JS expression (workaround for common-workflow-language/cwl-v1.3#52), theformat
check should consider any relevant resolution of$namespaces
beforehand.Actual Behavior
The
format
check fails if the input file format and the evaluated format do not match exactly. Since$namespaces
can be used to write equivalent formats (i.e.:https://www.iana.org/assignments/media-types/application/geo+json
↔iana:application/geo+json
), they should be considered interchangeably. However, theformat
expression fails unless the evaluated format is explicitly written in its long form (ie: the full URI).Given that inputs submitted (in
job.yml
) either with the long-form URI or the namespace'dformat
are both converted to the long-form URI when reaching the below check, this forces the JS expression to use the long-form URI to be considered valid.cwltool/cwltool/builder.py
Lines 555 to 559 in 6d8c2a4
However, for a user writing the CWL document that defined a
$namespace
section, it is very counter-intuitive to use the long-form URI only in theformat
expression, when everywhere else acceptsiana:application/geo+json
.Workflow Code
job.yml
OR
echo_features.cwl
Full Traceback
Your Environment
The text was updated successfully, but these errors were encountered: