Skip to content

Fix cml runner --cloud-gpu to accept nogpu - #747

Merged
0x2b3bfa0 merged 4 commits into
iterative:masterfrom
dacbd:cloud-gpu-fix
Sep 24, 2021
Merged

0x2b3bfa0 merged 4 commits into
iterative:masterfrom
dacbd:cloud-gpu-fix

Conversation

@dacbd

@dacbd dacbd commented Sep 24, 2021 •

Copy link
Copy Markdown
Contributor

@casperdcl
casperdcl requested a review from 0x2b3bfa0 September 24, 2021 16:05
@dacbd
dacbd marked this pull request as ready for review September 24, 2021 16:11
@dacbd

dacbd commented Sep 24, 2021

Copy link
Copy Markdown
Contributor Author

Functional test:

dabarnes@ubuntu:~/projects/cml$ ./bin/cml.js runner \
>     --single \
>     --log=debug \
>     --idle-timeout=1800 \
>     --token=xxx \
>     --cloud=gcp \
>     --cloud-region=us-west \
>     --cloud-type=m \
>     --cloud-gpu=nogpu \
>     --repo=xxx \
>     --driver=github \
>     --cloud-hdd-size=10
info: Preparing workdir /home/dabarnes/.cml/cml-2g7sdfdtiy...
info: Deploying cloud runner plan...
info: Terraform apply...
info: {"awsSecurityGroup":null,"cloud":"gcp","driver":"github","id":"iterative-34qzkcov8n4ws","idleTimeout":1800,"image":null,"instanceGpu":null,"instanceHddSize":10,"instanceIp":"xxx","instanceLaunchTime":"2021-09-24 09:05:45.397746969 -0700 PDT m=+28.798050565","instanceType":"m","labels":"cml","name":"cml-2g7sdfdtiy","region":"us-west","repo":"xxx","single":true,"spot":false,"spotPrice":-1,"timeouts":null}

Comment thread bin/cml/runner.js Outdated
cloudGpu: {
type: 'string',
choices: ['nogpu', 'k80', 'v100', 'tesla'],
choices: ['nogpu', 'k80', 'v100', 'tesla', null],

@DavidGOrtega DavidGOrtega Sep 24, 2021 •

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what I suggested

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor

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" 🙏

@dacbd dacbd Sep 24, 2021 •

Copy link
Copy Markdown
Contributor Author

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" 🙏

🤣

@dacbd dacbd mentioned this pull request Sep 24, 2021
@dacbd
dacbd marked this pull request as draft September 24, 2021 18:40
@dacbd
dacbd temporarily deployed to external September 24, 2021 18:46 Inactive
@dacbd

dacbd commented Sep 24, 2021

Copy link
Copy Markdown
Contributor Author

Updated to use undefined vs null works as expected from my test:

dabarnes@ubuntu:~/projects/cml$ ./bin/cml.js runner \
>     --single \
>     --log=debug \
>     --idle-timeout=1800 \
>     --token=xxx\
>     --cloud=gcp \
>     --cloud-region=us-west \
>     --cloud-type=m \
>     --cloud-gpu=nogpu \
>     --repo=xxx \
>     --driver=github \
>     --cloud-hdd-size=10
info: Preparing workdir /home/dabarnes/.cml/cml-jnnd5x6sq0...
info: Deploying cloud runner plan...
info: Terraform apply...
info: {"awsSecurityGroup":null,"cloud":"gcp","driver":"github","id":"iterative-2v4cyhm47w2q7","idleTimeout":1800,"image":null,"instanceGpu":null,"instanceHddSize":10,"instanceIp":"xxx","instanceLaunchTime":"2021-09-24 11:41:41.997215239 -0700 PDT m=+24.104635525","instanceType":"m","labels":"cml","name":"cml-jnnd5x6sq0","region":"us-west","repo":"xxx","single":true,"spot":false,"spotPrice":-1,"timeouts":null}

@dacbd
dacbd marked this pull request as ready for review September 24, 2021 18:49
@0x2b3bfa0 0x2b3bfa0 changed the title --cloud-gpu patch Fix cml runner --cloud-gpu to accept nogpu Sep 24, 2021
@0x2b3bfa0
0x2b3bfa0 merged commit fdd0acd into iterative:master Sep 24, 2021
@0x2b3bfa0

Copy link
Copy Markdown
Member

Thank you very much, @DanielBarnes!

@DavidGOrtega

Copy link
Copy Markdown
Contributor

Thank you very much, @DanielBarnes!

I subscribe!!! Thanks @DanielBarnes

@casperdcl casperdcl added bug Something isn't working cml-runner Subcommand labels Sep 27, 2021
@DavidGOrtega DavidGOrtega mentioned this pull request Oct 16, 2021

This branch was previously deployed

1 inactive deployment
external — 05f8d5fc Deployed Sep 24, 2021 by dacbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cml-runner Subcommand

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CML runner error parsing cloud-gpu

5 participants