From bd31f1756f364062181407ebb427fb101173c12e Mon Sep 17 00:00:00 2001 From: Cyril Diagne Date: Sat, 12 Oct 2019 12:40:07 +0200 Subject: [PATCH] Deprecate dev image & use image from arg instead. Fix #9 --- cmd/dev-start.go | 11 ++++---- docs/kuda/cli.md | 9 ++++++- docs/kuda/remote_development.md | 4 ++- images/dev/Dockerfile | 3 --- images/dev/README.md | 8 ------ images/providers/gcp/.config.sh | 2 -- images/providers/gcp/dev_start.sh | 44 +++++++++++++++---------------- 7 files changed, 39 insertions(+), 42 deletions(-) delete mode 100644 images/dev/Dockerfile delete mode 100644 images/dev/README.md diff --git a/cmd/dev-start.go b/cmd/dev-start.go index 43fb50a..8a44e2b 100644 --- a/cmd/dev-start.go +++ b/cmd/dev-start.go @@ -29,11 +29,12 @@ import ( // startCmd represents the `dev start` command var startCmd = &cobra.Command{ - Use: "start", + Use: "start [docker-image]", Short: "Start a dev session.", - Long: "Start a dev session.", + Long: "Start a dev session using the provider docker image.", + Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - if err := start(); err != nil { + if err := start(args[0]); err != nil { fmt.Println("ERROR:", err) } }, @@ -43,12 +44,12 @@ func init() { devCmd.AddCommand(startCmd) } -func start() error { +func start(devImage string) error { fmt.Println("→ Starting a remote session...") // Image to run. image := viper.GetString("image") // Command to run. - command := []string{"kuda_dev_start"} + command := []string{"kuda_dev_start", devImage} // Add the CWD to the volumes mounted in Docker. dir, err := os.Getwd() diff --git a/docs/kuda/cli.md b/docs/kuda/cli.md index 5c45ca2..35206b8 100644 --- a/docs/kuda/cli.md +++ b/docs/kuda/cli.md @@ -32,17 +32,24 @@ Deletes the remote cluster. ### → Start ```bash -kuda dev start +kuda dev start [base-image] ``` Starts a remote dev session with the current working directory. +**Example:** `kuda dev start nvidia/cuda:10.1-base` + This command: - Provisions a node with GPU on the cluster & install the nvidia driver - Starts a development pod based on the Deep Learning VM - Synchronise the directory provided as parameter with the remote node +List of recommended `base-image`: + +- all images from [nvidia/cuda](https://hub.docker.com/r/nvidia/cuda/) +- gcloud's [Deep Learning containers](https://cloud.google.com/ai-platform/deep-learning-containers/docs/choosing-container) + ### → Stop ```bash diff --git a/docs/kuda/remote_development.md b/docs/kuda/remote_development.md index 6861895..587affd 100644 --- a/docs/kuda/remote_development.md +++ b/docs/kuda/remote_development.md @@ -19,9 +19,11 @@ Developping on remote sessions offers many other advantages such as: Start a remote dev session that will be provisioned on your cluster. ```bash -kuda dev start +kuda dev start nvidia/cuda:10.1-base ``` +`nvidia/cuda:10.1-base` Is the docker image to use as base. It allows you to specify which version of CUDA and CuDNN you need. You can find a list of suggested images in the kuda dev [reference page](https://docs.kuda.dev/kuda/cli#dev). + This command will start the remote session and synchronize the CWD \(current working directory\) with the remote instance. Upon started, it will also print the cluster's IP address / port to use later on. Make not of that as we'll refer to it later as `` diff --git a/images/dev/Dockerfile b/images/dev/Dockerfile deleted file mode 100644 index 4625b28..0000000 --- a/images/dev/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM gcr.io/deeplearning-platform-release/base-cu100 - -WORKDIR /app_home \ No newline at end of file diff --git a/images/dev/README.md b/images/dev/README.md deleted file mode 100644 index 8e9c095..0000000 --- a/images/dev/README.md +++ /dev/null @@ -1,8 +0,0 @@ -To build & deploy this image: - -```bash -cd $KUDA_DIR - -docker build -f images/dev/Dockerfile -t gcr.io/kuda-project/dev:1.0.0 . -docker push $KUDA_VERSION -``` \ No newline at end of file diff --git a/images/providers/gcp/.config.sh b/images/providers/gcp/.config.sh index 30645fe..c37b82e 100644 --- a/images/providers/gcp/.config.sh +++ b/images/providers/gcp/.config.sh @@ -26,8 +26,6 @@ export KUDA_DEFAULT_GPU="${KUDA_DEFAULT_GPU:-k80}" export KUDA_DEFAULT_USE_PREEMPTIBLE="${KUDA_DEFAULT_USE_PREEMPTIBLE:-false}" export KUDA_DEV_APP_NAME="${KUDA_DEV_APP_NAME:-kuda-dev}" -export KUDA_DEV_APP_IMAGE_NAME="${KUDA_DEV_APP_IMAGE_NAME:-kuda-dev-base}" -export KUDA_DEV_APP_IMAGE="${KUDA_DEV_APP_IMAGE:-gcr.io/kuda-project/dev:1.0.0}" export KUDA_DEV_SYNC_PATH="${KUDA_DEV_SYNC_PATH:-/app_home}" # Disable prompts. diff --git a/images/providers/gcp/dev_start.sh b/images/providers/gcp/dev_start.sh index cb03504..2cea13f 100755 --- a/images/providers/gcp/dev_start.sh +++ b/images/providers/gcp/dev_start.sh @@ -13,11 +13,9 @@ gcloud container clusters get-credentials $KUDA_GCP_CLUSTER_NAME # --num-nodes 1 \ # --quiet -# TODO: Support multiple sessions. -# tmp_uuid=$(od -x /dev/urandom | head -1 | awk '{print $2$3}') -# KUDA_DEV_APP_NAME=kuda-dev-$tmp_uuid - -# exit 1 +uid=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 7) +dev_app_name=$KUDA_DEV_APP_NAME-$uid +dev_image=$1 # Launch. # TODO: materialize as external yaml file and customize @@ -26,39 +24,41 @@ cat <