Managing Locations with CLI

The CLI uses the term context instead of location.

Prerequisites for Remote Locations

  • The remote system must be Ubuntu 22.04, NVIDIA AI Workbench must already be installed, and the system must be switched on and available via SSH. For installation, see here in the Installation section.

  • The SSH key cannot be password protected. To set up your passwordless SSH access to the remote system, follow these general instructions:

    1. Execute cd /home/user && ssh-keygen on the local system to create an SSH key pair. Follow the prompts for key name, eg. /home/user/.ssh/id_rsa, and leave the password prompt empty.

    2. From the local system, add the public key to the .ssh/authorized_keys file on the remote system.

      • On Powershell:

        Copy
        Copied!
                    

        type$env:USERPROFILE\.ssh\id_rsa.pub | ssh user@10.123.4.56 "cat >> .ssh/authorized_keys"


      • On MacOS or Ubuntu:

        Copy
        Copied!
                    

        ssh-copy-id user@10.123.4.56


    Note

    If you already have an SSH key that is passwordless on your local machine, you can use that. However, if you do not have an SSH key or if you have an SSH key that has a password, you will need to generate a new SSH key that is passwordless.


  • The IP Address and SSH username must be known, the SSH private key saved on your local system, and the SSH public key must added to your remote system.

  • To use a Remote Location you must first add it to your Local AI Workbench. You can add multiple Remote Locations.

  • Once a Location is added, you can work on it by activating it in a terminal session.

Listing Remote Locations with the CLI

On your local system, in the command line, run the command:

Copy
Copied!
            

nvwb list contexts

Example Output:

Copy
Copied!
            

$ nvwb list contexts NAME │ DESCRIPTION │ HOSTNAME │ STATUS ──────────────────────────────────────────────────────────────────────── rtx-workstation │ 4x RTX 6000 Ada GPUs │ <ip_address> │ ⚫ Not Running vmware-system │ 8x L40S GPUs │ <ip_address> │ ⚫ Not Running local │ GeForce RTX 4090 Laptop │ localhost │ ⚫ Not Running oci-1 │ BM.GPU.A100-v2.8 | <ip_address> │ ⚫ Not Running

In the example output above you can see four locations, one of which is local. None of them are active.

What Can Go Wrong

NA

Creating a Remote Location with the CLI

On your local system:

  1. In the command line, run the command:

    Copy
    Copied!
                

    nvwb create context


  2. Follow the instructions on the screen and enter the relevant information. Hit Return to move to the next entry. You will be asked to enter:

    • A unique name for the Remote Location:

      Copy
      Copied!
                  

      ? Enter a unique name for the context: <name>


    • A brief description of the Remote Location:

      Copy
      Copied!
                  

      ? Enter a description: Some string here


    • The IP address of the Remote system:

      Copy
      Copied!
                  

      ? Enter the hostname of the system running this context: <ip_address>


    • The SSH username for accessing the Remote system:

      Copy
      Copied!
                  

      ? Enter the workbench directory for this context: /home/<user_name>/.nvwb


    • The absolute path to the SSH key on your local system:

      Copy
      Copied!
                  

      ? Enter your SSH username: <user_name>


    • The absolute path to the .nvwb directory on the Remote system:

      Copy
      Copied!
                  

      ? Enter the path to your SSH key: [? for help, tab for suggestions] <absolute_path_key>


Updating a Remote Location with the CLI

You can change everything but the name for Remote locations that have been added to your local AI Workbench. This includes the ports used to connect to the remote system.

  1. The remote system corresponding to the new information must be running so AI Workbench can connect to it via SSH.

  2. On your local system, in the command line, run the command:

    Copy
    Copied!
                

    nvwb update <location_name>


    Where <location_name> is the name of the remote location you want to update.

  3. Follow the instructions on the screen enter the relevant information and hit return. If you don’t want to modify the value, just hit return to proceed.

    1. The description

    2. The IP address

    3. The SSH username for accessing the Remote system

    4. The absolute path to the SSH key on your local system

    5. The absolute path to the .nvwb directory on the remote system

    6. The Proxy port

    7. The Service port

    If you don’t want to change a given field, you can keep the previous value by hitting return.

Activating a Remote Location with the CLI

On your Local system, in the command line, run the command:

Copy
Copied!
            

nvwb activate <location_name>

Where <location_name> is the name of the Remote location you wish to activate.

If the location is successfully activated, your prompt will change to reflect this.

Deactivating a Remote Location with the CLI

To deactivate a location with the CLI, you must be in a terminal with the location activated.

On your Local system, in the command line, run the command:

Copy
Copied!
            

nvwb deactivate

Deleting a Remote Location with the CLI

You can delete Remote Location from your local AI Workbench. This does not affect the remote system’s state or the Projects stored on that system. After a Remote Location is deleted AI Workbench will remain installed on that remote system, but the Location can no longer be detected or used.

Note that deleting a Remote Location does not stop the remote system. If you don’t want it to remain on, you must shut it off manually.

You can always add the Remote Location again and reuse it by adding the steps above.

  1. To delete a Remote location, first check the status to verify it is deactivated. From a shell on your Local system, run the command:

    Copy
    Copied!
                

    nvwb list contexts


  2. If the location is not active, then, from a shell on your Local system, run the command:

    Copy
    Copied!
                

    nvwb delete <location_name>


    Where <location_name> is the name of the Remote location you wish to remove.

Previous Command-line Interface (CLI) Basics
Next Configuring Integrations with CLI
© Copyright 2023-2024, NVIDIA. Last updated on Jan 21, 2024.