Skip to content
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

Missing feature: show the spec of a MIG profile #1

Open
kpouget opened this issue Mar 10, 2021 · 8 comments
Open

Missing feature: show the spec of a MIG profile #1

kpouget opened this issue Mar 10, 2021 · 8 comments

Comments

@kpouget
Copy link

kpouget commented Mar 10, 2021

It would be nice if we could the tool to query content of a configuration file (most important is the 2nd command):

# nvidia-mig-parted show -f examples/config.yaml
version: v1
mig-configs:
  - all-disabled
  - all-enabled
  -  ...

# nvidia-mig-parted show -f examples/config.yaml -c all-balanced
version: v1
all-balanced:
  - devices: all
    mig-enabled: true
    mig-devices:
      "1g.5gb": 2
      "2g.10gb": 1
      "3g.20gb": 1

along with nvidia-mig-parted export, this would allow a script to detect if applying a profile would change the state of mig-enabled property

@elezar
Copy link
Member

elezar commented Mar 10, 2021

Thanks @kpouget. When I read:

this would allow a script to detect if applying a profile would change the state of mig-enabled property

I immediately think of something like a dry-run mode or behaviour similar to terraform plan that previews the changes between what the current state is and what the desired state is.

I don't see how the show command indicates whether the mig-enabled property would change as it does not seem to query the current state.

update: ok, I get it, one would also export the current state and then diff the output from show.

@kpouget
Copy link
Author

kpouget commented Mar 10, 2021

yes, it looks like a dry-run, the only thing is that I don't expect the output of a --dry-run command to be yaml-parseable, while export and show have a single purpose, so it's easier to guarantee that they output proper yaml

@klueska
Copy link
Contributor

klueska commented Mar 10, 2021

I was already planning to add something to be able to check if a config exists in the config file so I can bail out early if a user asks for a mig configuration that is not there. I think this would serve that purpose as well since a call to something like:

# nvidia-mig-parted show -f examples/config.yaml -c non-existent-config

Would presumably throw an error saying that the requested config does not exist

@klueska
Copy link
Contributor

klueska commented Mar 10, 2021

That said -- the functionality you are asking for @kpouget seems to already be there with the assert command.

To detect if applying a profile would change the state of mig-enabled, you would run:

nvidia-mig-parted assert --mode-only -f examples/config.yaml -c all-1g.5gb

If this throws an error, then at least one of the mode settings in all-1g.5gb is different than what is currently applied on the node.

@klueska
Copy link
Contributor

klueska commented Mar 10, 2021

Here is an example of where I use assert for exactly this purpose in the systemd service:
https://github.com/NVIDIA/mig-parted/blob/master/deployments/systemd/service.sh#L30

@klueska
Copy link
Contributor

klueska commented Mar 10, 2021

This usage of assert used to actually be part of the README, but was removed recently:
aa797d8#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L127

@kpouget
Copy link
Author

kpouget commented Mar 10, 2021

Here is an example of where I use assert for exactly this purpose in the systemd service:
https://github.com/NVIDIA/mig-parted/blob/master/deployments/systemd/service.sh#L30

hum, nice,
actually it's this service.sh script that I need to use to perform the reconfiguration, not directly nvidia-mig-parted

@klueska
Copy link
Contributor

klueska commented Mar 10, 2021

That script is used when the node i first coming online at bootup.

This script is used while a node is up and running to change the config:
https://github.com/NVIDIA/mig-parted/blob/master/deployments/systemd/apply-config.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants