-
Notifications
You must be signed in to change notification settings - Fork 341
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
Fix cml runner --cloud-gpu to accept nogpu
#747
Conversation
dacbd
commented
Sep 24, 2021
•
edited by DavidGOrtega
Loading
edited by DavidGOrtega
- Closes CML runner error parsing cloud-gpu #746
Functional test:
|
bin/cml/runner.js
Outdated
@@ -469,7 +469,7 @@ exports.builder = (yargs) => | |||
}, | |||
cloudGpu: { | |||
type: 'string', | |||
choices: ['nogpu', 'k80', 'v100', 'tesla'], | |||
choices: ['nogpu', 'k80', 'v100', 'tesla', null], |
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.
Interesting that this is not working. It was as far as I remember. Maybe using undefined
in the coerce function do the trick? If thats the case maybe is better than null explicitly which is going to be a difficult type to setup
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 tried changing the value and it seemed that if the result of the coerce function isn't in the choices array then it fails.
My very first patch was to set it to 'nogpu'
instead of null which worked fine.
I opted to add null
as an option instead to preserve the truthy/falsy behavior in ternary statements.
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'll try this and we can see.
choices: ['nogpu', 'k80', 'v100', 'tesla'],
coerce: (val) => (val === 'nogpu' ? undefined : val),
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.
Thats what I suggested
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.
@DavidGOrtega It looks like undefined
behaves as expected, Im going to do a full test in our gcp env and if it works as expected I'll update the PR.
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.
See also yargs/yargs#756
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.
@DavidGOrtega It looks like undefined behaves as expected, Im going to do a full test in our gcp env and if it works as expected I'll update the PR.
@danielbarnes that was my intuition, since its allowing you to not set it, I would say that this worked also with null previously, but not sure... JS and its non "Good parts" 🙏
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.
JS and its non "Good parts" 🙏
🤣
Updated to use
|
nogpu
Thank you very much, @danielbarnes! |
I subscribe!!! Thanks @danielbarnes |