# DRUM CLI tool
URL: https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-drum.html

> DataRobot Model Runner is a tool that allows you to work with Python, R, and Java custom models and to quickly test custom tasks.

# DRUM CLI tool

The DataRobot User Models (DRUM) CLI is a tool that allows you to work with Python, R, and Java custom models and to quickly test [custom tasks](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-custom-tasks.html), [custom models](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/index.html), and [custom environments](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/custom-models/custom-model-environments/custom-environments.html) locally before uploading into DataRobot. Because it is also used to run custom tasks and models inside of DataRobot, if they pass local tests with DRUM, they are compatible with DataRobot. You can download DRUM from [PyPI](https://pypi.org/project/datarobot-drum/) and [access DRUM's GitHub repo](https://github.com/datarobot/datarobot-user-models/).

DRUM can also:

- Run performance and memory usage testing for models.
- Perform model validation tests (for example, checking model functionality on corner cases, like null values imputation).
- Run models in a Docker container.

You can install DRUM for [Ubuntu](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-drum.html#drum-on-ubuntu), [Windows](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-drum.html#drum-on-windows-with-wsl2), or [MacOS](https://docs.datarobot.com/en/docs/classic-ui/modeling/special-workflows/cml/cml-drum.html#drum-on-mac).

> [!NOTE] Note
> DRUM is not regularly tested on Windows or Mac. These steps may differ depending on the configuration of your machine.

## DRUM on Ubuntu

The following describes the DRUM installation workflow. Consider the language prerequisites before proceeding.

| Language | Prerequisites | Installation command |
| --- | --- | --- |
| Python | Python 3 required | pip install datarobot-drum |
| Java | JRE ≥ 11 | pip install datarobot-drum |
| R | Python ≥ 3.6R framework installedDRUM uses the rpy2 package to run R (the latest version is installed by default). You may need to adjust the rpy2 and pandas versions for compatibility. | pip install datarobot-drum[R] |

To install the DRUM with support for Python and Java models, use the following command:

```
pip install datarobot-drum
```

To install DRUM with support for R models:

```
pip install datarobot-drum[R]
```

> [!NOTE] Note
> If you are using a Conda environment, install the wheels with a `--no-deps` flag. If any dependencies are required for a Conda environment, install them with Conda tools.

## DRUM on Mac

The following instructions describe installing DRUM with `conda` (although you can use other tools if you prefer) and then using DRUM to test a task locally. Before you begin, DRUM requires:

- An installation ofconda.
- A Python environment (also required for R) of 3.7+.

### Install DRUM on Mac

1. Create and activate a virtual environment with Python 3.7+. In the terminal for 3.8, run: condacreate-nDR-custom-taskspython=3.8-y
condaactivateDR-custom-tasks
2. Install DRUM: condainstall-cconda-forgeuwsgi-y
pipinstalldatarobot-drum
3. To set up the environment, installDocker Desktopand download from GitHub the DataRobotdrop-in environmentswhere your tasks will run. This recommended procedure ensures that your tasks run in the same environment both locally and inside DataRobot. Alternatively, if you plan to run your tasks in a localpythonenvironment, install packages used by your custom task into the same environment as DRUM.

### Use DRUM on Mac

To test a task locally, run the `drum fit` command. For example, in a binary classification project:

1. Ensure that thecondaenvironmentDR-custom-tasksis activated.
2. Run thedrum fitcommand (replacing placeholder folder names in< >brackets with actual folder names): drum fit --code-dir <folder_with_task_content> --input <test_data.csv>  --target-type binary --target <target_column_name> --docker <folder_with_dockerfile> --verbose For example: drum fit --code-dir datarobot-user-models/custom_tasks/examples/python3_sklearn_binary --input datarobot-user-models/tests/testdata/iris_binary_training.csv --target-type binary --target Species --docker datarobot-user-models/public_dropin_environments/python3_sklearn/ --verbose

> [!TIP] Tip
> To learn more, you can view available parameters by typing `drum fit --help` on the command line.

## DRUM on Windows with WSL2

DRUM can be run on Windows 10 or 11 with WSL2 (Windows Subsystem for Linux), a native extension that is supported by the latest versions of Windows and allows you to easily install and run Linux OS on a Windows machine. With WSL, you can develop custom tasks and custom models locally in an IDE on Windows, and then immediately test and run them on the same machine using DRUM via the Linux command line.

> [!TIP] Tip
> You can use this [YouTube video](https://www.youtube.com/watch?v=wWFI2Gxtq-8) for instructions on installing WSL into Windows 11 and updating Ubuntu.

The following phases are required to complete the Windows DRUM installation:

1. Enable WSL
2. Installpyenv
3. Install DRUM
4. Install Docker Desktop

### Enable Linux (WSL)

1. FromControl Panel > Turn Windows features on or off, check the optionWindows Subsystem for Linux. After making changes, you will be prompted to restart.
2. OpenMicrosoft storeand click to get Ubuntu.
3. Install Ubuntu and launch it from the start prompt. Provide a Unix username and password to complete installation. You can use any credentials but be sure to record them as they will be required in the future.

You can access Ubuntu at any time from the Windows start menu. Access files on the C drive under /mnt/c/.

### Install pyenv

Because Ubuntu in WSL comes without Python or virtual environments installed, you must install `pyenv`, a Python version management program used on macOS and Linux. (Learn about managing multiple Python environments [here](https://codeburst.io/how-to-install-and-manage-multiple-python-versions-in-wsl2-1131c4e50a58).)

In the Ubuntu terminal, run the following commands (you can ignore comments) row by row:

```
cd $HOME
sudo apt update --yes
sudo apt upgrade --yes

sudo apt-get install --yes git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv

#add pyenv to bashrc
echo '# Pyenv environment variables' >> ~/.bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo '# Pyenv initialization' >> ~/.bashrc
echo 'if command -v pyenv 1>/dev/null 2>&1; then' >> ~/.bashrc
echo '  eval "$(pyenv init -)"' >> ~/.bashrc
echo 'fi' >> ~/.bashrc

#restart shell
exec $SHELL

#install pyenv dependencies (copy as a single line)
sudo apt-get install --yes libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libgdbm-dev lzma lzma-dev tcl-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev wget curl make build-essential python-openssl

#install python 3.7 (it can take awhile)
pyenv install 3.7.10
```

### Install DRUM on Windows

To install DRUM, first you setup a Python environment where DRUM will run, and then install DRUM in that environment.

1. Create and activate apyenvenvironment: cd$HOMEpyenvlocal3.7.10
.pyenv/shims/python3.7-mvenvDR-custom-tasks-pyenvsourceDR-custom-tasks-pyenv/bin/activate
2. Install DRUM and its dependencies into that environment: pipinstalldatarobot-drumexec$SHELL
3. Download container environments, where DRUM will run, from Github. git clone https://github.com/datarobot/datarobot-user-models

### Install Docker Desktop

While you can run DRUM directly in the `pyenv` environment, it is preferable to run it in a Docker container. This recommended procedure ensures that your tasks run in the same environment both locally and inside DataRobot, as well as simplifies installation.

1. Download and installDocker Desktop, following the default installation steps.
2. Enable Ubuntu version WSL2 by opening Windows PowerShell and running: wsl.exe--set-versionUbuntu2wsl--set-default-version2 NoteYou may need to download and install anupdate. Follow the instructions in the PowerShell until you see theConversion completemessage.
3. Enable access to Docker Desktop from Ubuntu:

### Use DRUM on Windows

1. From the command line, open an Ubuntu terminal.
2. Use the following commands to activate the environment: cd $HOME
source DR-custom-tasks-pyenv/bin/activate
3. Run thedrum fitcommand in an Ubuntu terminal window (replacing placeholder folder names in< >brackets with actual folder names): drum fit --code-dir <folder_with_task_content> --input <test_data.csv>  --target-type binary --target <target_column_name> --docker <folder_with_dockerfile> --verbose For example: drum fit --code-dir datarobot-user-models/custom_tasks/examples/python3_sklearn_binary --input datarobot-user-models/tests/testdata/iris_binary_training.csv --target-type binary --target Species --docker datarobot-user-models/public_dropin_environments/python3_sklearn/ --verbose

---
