milatools


Namemilatools JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryTools to work with the Mila cluster
upload_time2025-07-08 14:44:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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

We recommend using [`uv`](https://docs.astral.sh/uv/) in order to use `milatools` in its own isolated environment instead of alterring your default Python environment or creating and activating a new one manually.

```bash
uv tool install milatools
```

_Alternatively_:

```bash
pip install milatools
```

Or, for bleeding edge version:

```bash
uv tool install git+https://github.com/mila-iqia/milatools.git
# OR
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] [--cluster {mila,cedar,narval,beluga,graham}] [--alloc ...]
                 [--command VALUE] [--job VALUE] [--node VALUE] [--persist]
                 PATH

positional arguments:
  PATH                  Path to open on the remote machine

options:
  -h, --help            show this help message and exit
  --alloc ...           Extra options to pass to slurm
  --cluster {mila,cedar,narval,beluga,graham}
                        Which cluster to connect to.
  --command VALUE       Command to use to start vscode (defaults to "code" or the value
                        of $MILATOOLS_CODE_COMMAND)
  --job VALUE           Job ID to connect to
  --node VALUE          Node to connect to
  --persist             Whether the server should persist or not
```

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=gpu:1` to allocate 1 GPU). `--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": null,
    "name": "milatools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Olivier Breuleux <breuleux@gmail.com>, Fabrice Normandin <fabrice.normandin@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/7b/470f97ffc49584666dff51fb4effe72c0a63d557692cc01126165ef29975/milatools-0.1.8.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\nWe recommend using [`uv`](https://docs.astral.sh/uv/) in order to use `milatools` in its own isolated environment instead of alterring your default Python environment or creating and activating a new one manually.\n\n```bash\nuv tool install milatools\n```\n\n_Alternatively_:\n\n```bash\npip install milatools\n```\n\nOr, for bleeding edge version:\n\n```bash\nuv tool install git+https://github.com/mila-iqia/milatools.git\n# OR\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] [--cluster {mila,cedar,narval,beluga,graham}] [--alloc ...]\n                 [--command VALUE] [--job VALUE] [--node VALUE] [--persist]\n                 PATH\n\npositional arguments:\n  PATH                  Path to open on the remote machine\n\noptions:\n  -h, --help            show this help message and exit\n  --alloc ...           Extra options to pass to slurm\n  --cluster {mila,cedar,narval,beluga,graham}\n                        Which cluster to connect to.\n  --command VALUE       Command to use to start vscode (defaults to \"code\" or the value\n                        of $MILATOOLS_CODE_COMMAND)\n  --job VALUE           Job ID to connect to\n  --node VALUE          Node to connect to\n  --persist             Whether the server should persist or not\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=gpu:1` to allocate 1 GPU). `--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": null,
    "summary": "Tools to work with the Mila cluster",
    "version": "0.1.8",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5918501acb5e788806aabe7fbe6bab8176b9cff7a6ce4f6fe9994d87ee62e8c0",
                "md5": "8a1adb1134ae49f510213476b0ce775e",
                "sha256": "d22d1fa3afbf1c93b749bb435d19408260895a37a80cc6063eb8d6b9a7a594a4"
            },
            "downloads": -1,
            "filename": "milatools-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a1adb1134ae49f510213476b0ce775e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 64935,
            "upload_time": "2025-07-08T14:44:29",
            "upload_time_iso_8601": "2025-07-08T14:44:29.040318Z",
            "url": "https://files.pythonhosted.org/packages/59/18/501acb5e788806aabe7fbe6bab8176b9cff7a6ce4f6fe9994d87ee62e8c0/milatools-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb7b470f97ffc49584666dff51fb4effe72c0a63d557692cc01126165ef29975",
                "md5": "a6f7d00ace2745c0e9de03e078a8a338",
                "sha256": "d99abc32101f1fd8e0f4b3271f9be4b39d2c25e66f54b4c4f5ec1e1e631225e0"
            },
            "downloads": -1,
            "filename": "milatools-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "a6f7d00ace2745c0e9de03e078a8a338",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 155763,
            "upload_time": "2025-07-08T14:44:29",
            "upload_time_iso_8601": "2025-07-08T14:44:29.954306Z",
            "url": "https://files.pythonhosted.org/packages/cb/7b/470f97ffc49584666dff51fb4effe72c0a63d557692cc01126165ef29975/milatools-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-08 14:44:29",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "milatools"
}
        
Elapsed time: 0.52347s