Skip to content

Install the Run:ai Command-line Interface

The Run:ai Command-line Interface (CLI) is one of the ways for a Researcher to send deep learning workloads, acquire GPU-based containers, list jobs, etc.

The instructions below will guide you through the process of installing the CLI. The Run:ai CLI runs on Mac and Linux. You can run the CLI on Windows by using Docker for Windows. See the end of this document.

Researcher Authentication

When enabled, Researcher authentication requires additional setup when installing the CLI. To configure authentication see Setup Project-based Researcher Access Control. Use the modified Kubernetes configuration file described in the article.

Prerequisites

  • When installing the command-line interface, it is worth considering future upgrades:
    • Install the CLI on a dedicated Jumpbox machine. Researchers will connect to the Jumpbox from which they can submit Run:ai commands
    • Install the CLI on a shared directory that is mounted on Researchers' machines.
  • A Kubernetes configuration file.

Setup

Kubernetes Configuration

  • On the Researcher's root folder, create a directory .kube. Copy the Kubernetes configuration file into the directory. Each Researcher should have a separate copy of the configuration file. The Researcher should have write access to the configuration file as it stores user defaults.
  • If you choose to locate the file at a different location than ~/.kube/config, you must create a shell variable to point to the configuration file as follows:
export KUBECONFIG=<Kubernetes-config-file>
  • Test the connection by running:
kubectl get nodes

Install Run:ai CLI

  • Go to the Run:ai user interface. On the top right select Researcher Command Line Interface.
  • Select Mac or Linux.
  • Download directly using the button or copy the command and run it on a remote machine
  • Run:
chmod +x runai
sudo mv runai /usr/local/bin/runai
  • Go to the Run:ai user interface. On the top right select Researcher Command Line Interface.
  • Select Windows
  • Download directly using the button or copy the command and run it on a remote machine
  • Rename the downloaded file to have a .exe extension and move the file to a folder that is a part of the PATH.
  • Install Docker for Windows.
  • Get the following folder from GitHub: https://github.com/run-ai/docs/tree/master/cli/windows.
  • Replace config with your Kubernetes Configuration file.
  • Replace <CLUSTER-URL> in the Dockerfile with the URL of the cluster. The URL can be found in the Clusters view of the Run:ai user interface.
  • Run: build.sh to create a docker image named runai-cli.

Test the image by running:

docker run -it runai-cli bash

If you get an error x509: certificate signed by unknown authority please contact Run:ai customer support

Try and connect to your cluster from inside the docker by running a Run:ai CLI command. E.g. runai list projects.

Distribute the image to Windows users.

  • In case you want to use port-forward feature please use the following command
docker run -it -p <PORT>:<PORT> runai-cli bash

And when using runai submit command add the following flag:

--address 0.0.0.0

Note

An alternative way of downloading the CLI is provided under the CLI Troubleshooting section.

To verify the installation run:

runai list jobs

Install Command Auto-Completion

It is possible to configure your Linux/Mac shell to complete Run:ai CLI commands. This feature works on bash and zsh shells only.

Zsh

Edit the file ~/.zshrc. Add the lines:

autoload -U compinit; compinit -i
source <(runai completion zsh)

Bash

Install the bash-completion package:

  • Mac: brew install bash-completion
  • Ubuntu/Debian: sudo apt-get install bash-completion
  • Fedora/Centos: sudo yum install bash-completion

Edit the file ~/.bashrc. Add the lines:

[[ -r “/usr/local/etc/profile.d/bash_completion.sh” ]] && . “/usr/local/etc/profile.d/bash_completion.sh”
source <(runai completion bash)

Troubleshoot the CLI Installation

See Troubleshooting a CLI installation

Update the Run:ai CLI

To update the CLI to the latest version perform the same install process again.

Delete the Run:ai CLI

If you have installed using the default path, run:

sudo rm /usr/local/bin/runai

Last update: 2023-03-26
Created: 2023-03-26