-
Notifications
You must be signed in to change notification settings - Fork 6
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
updates for CWL CUDA, Resources, NetworkAccess requirements #506
Conversation
…nts + convert GPU->CUDA requirement
Codecov Report
@@ Coverage Diff @@
## master #506 +/- ##
==========================================
+ Coverage 83.74% 83.82% +0.08%
==========================================
Files 78 78
Lines 16256 16349 +93
Branches 2509 2525 +16
==========================================
+ Hits 13614 13705 +91
- Misses 1945 1947 +2
Partials 697 697
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…ig job log messages are clipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very solid PR, good job!
Minor question to verify about the cuda requirement.
), | ||
( | ||
{"requirements": {CWL_REQUIREMENT_APP_DOCKER_GPU: {"dockerPull": "python:3.7-alpine"}, | ||
CWL_REQUIREMENT_CUDA: {"custom": 1, "cudaVersionMin": "11.0", "cudaDeviceCountMin": 8}}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About using the Cuda requirements in a requirements
section, I am not sure it is working.
When I tested using them in the requirements
, I would get an error during process deployment.
<h1>422 Unprocessable Entity</h1>
Unable to process the contained instructions<br/><br/>
Invalid package/reference definition. Loading generated error: [Invalid package/reference definition. Loading package content generated error: [../../../tmp/tmpa7ns6fvb/package:1:52: checking field `requirements`
../../../tmp/tmpa7ns6fvb/package:1:172: checking item
Field `class` contains undefined reference to
`http://commonwl.org/cwltool#CUDARequirement`].
I only used hints
for it to work. Consequently, the CUDARequirementSpecification
was only added to hints in the swagger_definitions.py
.
So I am not sure if these examples are relevant since Cuda was not working as a requirements
.
Sorry if that was not clear in my previous PR. I suppose this might be fixed eventually if they update the doc on their side? Those examples would be the desired behavior if the requirements
would work, so maybe we can keep them and leave a comment about it? What do you think would be best here? Are you able to recreate the error I get?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mr-c
Can you confirm this case? The cwltool:CUDARequirement
is only permitted in hints
?
If so, that's another thing that could be specified in https://github.com/common-workflow-language/cwl-v1.2/issues/212
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cwltool:CUDARequirement
should almost always be under requirements
unless it truly is optional. When using cwltool
one needs to pass --enable-ext
. See https://github.com/common-workflow-language/cwltool/blob/0099f11d5a8740d3ca976cd40681523d1002e502/cwltool/main.py#LL661C15-L661C24
You could choose to permanently enable some of the extensions in weaver; it is up to you if you want a command-line flag or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an equivalent of --enable-ext
directly with the cwltool
code rather than the CLI?
We use the python factory with loading/runtime context and following parameters:
https://github.com/crim-ca/weaver/blob/master/weaver/processes/wps_package.py#L1288-L1309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently setup_schema
(which handles --enable-ext
) is only called from the CLI loop. So you'll need to call use_custom_schema()
at startup before using any of the factory methods.
If you don't want to enable all extensions, then make your own copy of extensions{,-v1.1,-v1.2}.yml
; otherwise you can use the copy inside the cwltool
module.
If you'd like, we can refactor setup_schema
to take in a boolean named "enable_ext" instead of an entire argparse.Namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mr-c
I have tried using use_custom_schema
(#510) as suggested, but I end up having the following error when the CWL document is loaded by the factory.
schema_salad.exceptions.ValidationException: http://commonwl.org/cwltool:2:3: checking object `http://commonwl.org/cwltool#CUDARequirement`
http://commonwl.org/cwltool:5:3: Field `extends` references unknown identifier
`cwl:ProcessRequirement`, tried
http://commonwl.org/cwltool#cwl:ProcessRequirement
http://commonwl.org/cwltool:6:3: checking field `fields`
http://commonwl.org/cwltool:22:5: checking object
`http://commonwl.org/cwltool#CUDARequirement/cudaDeviceCountMax`
Field `type` references unknown identifier
`cwl:Expression`, tried http://commonwl.org/cwltool#cwl:Expression
http://commonwl.org/cwltool:32:5: checking object
`http://commonwl.org/cwltool#CUDARequirement/cudaDeviceCountMin`
Field `type` references unknown identifier
`cwl:Expression`, tried http://commonwl.org/cwltool#cwl:Expression
Instead of the previous (expected) error:
schema_salad.exceptions.ValidationException: ../../../../tmp/tmp514w9uk1/test:1:114: checking field `requirements`
../../../../tmp/tmp514w9uk1/test:1:131: checking item
Field `class` contains undefined reference to
`http://commonwl.org/cwltool#CUDARequirement`
Is there something else to adjust on my end, or would that be an issue with the schema definitions (using https://github.com/common-workflow-language/cwltool/blob/3.1.20221201130942/cwltool/extensions-v1.2.yml)?
Tested CWL:
cwlVersion: v1.2
class: CommandLineTool
baseCommand:
- echo
- test
inputs: []
outputs: []
requirements:
cwltool:CUDARequirement:
cudaVersionMin: '10.0'
cudaComputeCapability: '3.0'
cudaDeviceCountMin: 1
cudaDeviceCountMax: 1
$namespaces:
cwltool: http://commonwl.org/cwltool#
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you filtered out too much? https://github.com/common-workflow-language/cwltool/blob/38f42e6c4fe17db5fe82acd8a59f97d3982c605b/cwltool/extensions-v1.2.yml#L1-L5 might be missing due to https://github.com/crim-ca/weaver/pull/510/files#diff-ce41af74805c1d891a393bd1488434a450041ca7cc7df4f3532b4e516badf656R426
Since you are pinning your cwltool version, it might be easier to just make your own copy of https://github.com/common-workflow-language/cwltool/blob/38f42e6c4fe17db5fe82acd8a59f97d3982c605b/cwltool/extensions-v1.2.yml and remove the unsupported extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you serialize the newly produced extension file and send me a link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found my mistake. I was passing down $graph
rather than the full definition to use_custom_schema
. Works as expected now!
I'm glad to see this and I'll eventually add similar code to cwl-upgrader when CUDARequirement is part of a released version of CWL (likely v1.3). What is the namespace for the |
There was no specific namespace employed. It was only used in |
Merging as is for the moment. |
Changes
cwltool:CUDARequirement
,ResourceRequirement
andNetworkAccess
.ResourceRequirement
.DockerGpuRequirement
, with attempts to auto-convert it into correspondingDockerRequirement
combined with
cwltool:CUDARequirement
definitions. If this conversion does not work transparently for the user,explicit
CWL
updates with those definitions should be made.CWL
requirement or hint to represent the application type.In case of missing requirement, the reported error will contain a documentation link to guide the user in adjusting
its
Application Package
accordingly.Refernces
cwltool:CUDARequirement
common-workflow-language/user_guide#414$schema
and$schemas
common-workflow-language/cwl-v1.2#138TODO
_update_package_compatibility
operationResourceRequirement
schema validation