# milatools
The milatools package provides the `mila` command, which is meant to help with connecting to and interacting with the Mila cluster.
---
**Warning**
The `mila` command is meant to be used on your local machine. Trying to run it on the cluster will fail with an error
---
## Install
Requires Python >= 3.8
```bash
pip install milatools
```
Or, for bleeding edge version:
```bash
pip install git+https://github.com/mila-iqia/milatools.git
```
After installing `milatools`, start with `mila init`:
```bash
mila init
```
## Commands
### mila init
Set up your access to the mila cluster interactively. Have your username and password ready!
* Set up your SSH config for easy connection with `ssh mila`
* Set up your public key if you don't already have them
* Copy your public key over to the cluster for passwordless auth
* Set up a public key on the login node to enable ssh into compute nodes
* **new**: Add a special SSH config for direct connection to a **compute node** with `ssh mila-cpu`
### mila docs/intranet
* Use `mila docs <search terms>` to search the Mila technical documentation
* Use `mila intranet <search terms>` to search the Mila intranet
Both commands open a browser window. If no search terms are given you are taken to the home page.
### mila code
Connect a VSCode instance to a compute node. `mila code` first allocates a compute node using slurm (you can pass slurm options as well using `--alloc`), and then calls the `code` command with the appropriate options to start a remote coding session on the allocated node.
You can simply Ctrl+C the process to end the session.
```
usage: mila code [-h] [--alloc ...] [--job VALUE] [--node VALUE] PATH
positional arguments:
PATH Path to open on the remote machine
optional arguments:
-h, --help show this help message and exit
--alloc ... Extra options to pass to slurm
--job VALUE Job ID to connect to
--node VALUE Node to connect to
```
For example:
```bash
mila code path/to/my/experiment
```
The `--alloc` option may be used to pass extra arguments to `salloc` when allocating a node (for example, `--alloc --gres=cpu:8` to allocate 8 CPUs). `--alloc` should be at the end, because it will take all of the arguments that come after it.
If you already have an allocation on a compute node, you may use the `--node NODENAME` or `--job JOBID` options to connect to that node.
### mila serve
The purpose of `mila serve` is to make it easier to start notebooks, logging servers, etc. on the compute nodes and connect to them.
```
usage: mila serve [-h] {connect,kill,list,lab,notebook,tensorboard,mlflow,aim} ...
positional arguments:
{connect,kill,list,lab,notebook,tensorboard,mlflow,aim}
connect Reconnect to a persistent server.
kill Kill a persistent server.
list List active servers.
lab Start a Jupyterlab server.
notebook Start a Jupyter Notebook server.
tensorboard Start a Tensorboard server.
mlflow Start an MLFlow server.
aim Start an AIM server.
optional arguments:
-h, --help show this help message and exit
```
For example, to start jupyterlab with one GPU, you may write:
```bash
mila serve lab --alloc --gres gpu:1
```
You can of course write any SLURM arguments after `--alloc`.
Ending the connection will end the server, but the `--persist` flag can be used to prevent that. In that case you would be able to write `mila serve connect jupyter-lab` in order to reconnect to your running instance. Use `mila serve list` and `mila serve kill` to view and manage any running instances.
Raw data
{
"_id": null,
"home_page": "https://github.com/mila-iqia/milatools",
"name": "milatools",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Olivier Breuleux",
"author_email": "breuleux@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b1/ac/9c4226476fd5f708cd1245f354bca4e030ff1fbb4bb40df6929b48f95914/milatools-0.1.4.tar.gz",
"platform": null,
"description": "\n# milatools\n\nThe milatools package provides the `mila` command, which is meant to help with connecting to and interacting with the Mila cluster.\n\n---\n\n**Warning**\n\nThe `mila` command is meant to be used on your local machine. Trying to run it on the cluster will fail with an error\n\n---\n\n\n## Install\n\nRequires Python >= 3.8\n\n```bash\npip install milatools\n```\n\nOr, for bleeding edge version:\n\n```bash\npip install git+https://github.com/mila-iqia/milatools.git\n```\n\nAfter installing `milatools`, start with `mila init`:\n\n```bash\nmila init\n```\n\n\n## Commands\n\n### mila init\n\nSet up your access to the mila cluster interactively. Have your username and password ready!\n\n* Set up your SSH config for easy connection with `ssh mila`\n* Set up your public key if you don't already have them\n* Copy your public key over to the cluster for passwordless auth\n* Set up a public key on the login node to enable ssh into compute nodes\n* **new**: Add a special SSH config for direct connection to a **compute node** with `ssh mila-cpu`\n\n\n### mila docs/intranet\n\n* Use `mila docs <search terms>` to search the Mila technical documentation\n* Use `mila intranet <search terms>` to search the Mila intranet\n\nBoth commands open a browser window. If no search terms are given you are taken to the home page.\n\n\n### mila code\n\nConnect a VSCode instance to a compute node. `mila code` first allocates a compute node using slurm (you can pass slurm options as well using `--alloc`), and then calls the `code` command with the appropriate options to start a remote coding session on the allocated node.\n\nYou can simply Ctrl+C the process to end the session.\n\n```\nusage: mila code [-h] [--alloc ...] [--job VALUE] [--node VALUE] PATH\n\npositional arguments:\n PATH Path to open on the remote machine\n\noptional arguments:\n -h, --help show this help message and exit\n --alloc ... Extra options to pass to slurm\n --job VALUE Job ID to connect to\n --node VALUE Node to connect to\n```\n\nFor example:\n\n```bash\nmila code path/to/my/experiment\n```\n\nThe `--alloc` option may be used to pass extra arguments to `salloc` when allocating a node (for example, `--alloc --gres=cpu:8` to allocate 8 CPUs). `--alloc` should be at the end, because it will take all of the arguments that come after it.\n\nIf you already have an allocation on a compute node, you may use the `--node NODENAME` or `--job JOBID` options to connect to that node.\n\n\n### mila serve\n\nThe purpose of `mila serve` is to make it easier to start notebooks, logging servers, etc. on the compute nodes and connect to them.\n\n```\nusage: mila serve [-h] {connect,kill,list,lab,notebook,tensorboard,mlflow,aim} ...\n\npositional arguments:\n {connect,kill,list,lab,notebook,tensorboard,mlflow,aim}\n connect Reconnect to a persistent server.\n kill Kill a persistent server.\n list List active servers.\n lab Start a Jupyterlab server.\n notebook Start a Jupyter Notebook server.\n tensorboard Start a Tensorboard server.\n mlflow Start an MLFlow server.\n aim Start an AIM server.\n\noptional arguments:\n -h, --help show this help message and exit\n```\n\nFor example, to start jupyterlab with one GPU, you may write:\n\n```bash\nmila serve lab --alloc --gres gpu:1\n```\n\nYou can of course write any SLURM arguments after `--alloc`.\n\nEnding the connection will end the server, but the `--persist` flag can be used to prevent that. In that case you would be able to write `mila serve connect jupyter-lab` in order to reconnect to your running instance. Use `mila serve list` and `mila serve kill` to view and manage any running instances.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Tools to work with the Mila cluster",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/mila-iqia/milatools",
"Repository": "https://github.com/mila-iqia/milatools"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c7160175160a63491e8150b1d0cbc4efa4006f10ba40e3bc7079b2e591ed3b87",
"md5": "e54493b57a6aa5efe78db040a7bebc25",
"sha256": "50a50dce8838e084241e46031bcb380ca6d8c96419829422fd7407a889ebddfd"
},
"downloads": -1,
"filename": "milatools-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e54493b57a6aa5efe78db040a7bebc25",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 49163,
"upload_time": "2024-04-17T19:18:32",
"upload_time_iso_8601": "2024-04-17T19:18:32.871124Z",
"url": "https://files.pythonhosted.org/packages/c7/16/0175160a63491e8150b1d0cbc4efa4006f10ba40e3bc7079b2e591ed3b87/milatools-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b1ac9c4226476fd5f708cd1245f354bca4e030ff1fbb4bb40df6929b48f95914",
"md5": "720fb373700a611fa4725da7000a2ce1",
"sha256": "7ef01772a4a82d209ec2068b7005a77b3f884b883ab67695c45480fa187dd223"
},
"downloads": -1,
"filename": "milatools-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "720fb373700a611fa4725da7000a2ce1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 44267,
"upload_time": "2024-04-17T19:18:34",
"upload_time_iso_8601": "2024-04-17T19:18:34.279614Z",
"url": "https://files.pythonhosted.org/packages/b1/ac/9c4226476fd5f708cd1245f354bca4e030ff1fbb4bb40df6929b48f95914/milatools-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-17 19:18:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mila-iqia",
"github_project": "milatools",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "milatools"
}