一般功能

安装 conda 包

使用 .adam scale conda install

示例:要将 NumPy 和 pandas 及其依赖项安装到名为 的集群上的 root conda 环境中cluster

$ adam scale -n cluster conda install numpy pandas
All nodes (x4) response:
{
  "actions": {
    "LINK": [
      "mkl-11.3.3-0 /opt/continuum/anaconda/pkgs 1",
      "openssl-1.0.2h-1 /opt/continuum/anaconda/pkgs 1",
      "sqlite-3.13.0-0 /opt/continuum/anaconda/pkgs 1",
      "zlib-1.2.8-3 /opt/continuum/anaconda/pkgs 1",
      "python-2.7.11-5 /opt/continuum/anaconda/pkgs 1",
      "conda-env-2.5.1-py27_0 /opt/continuum/anaconda/pkgs 1",
      "numpy-1.11.0-py27_2 /opt/continuum/anaconda/pkgs 1",
      "pycosat-0.6.1-py27_1 /opt/continuum/anaconda/pkgs 1",
      "pytz-2016.4-py27_0 /opt/continuum/anaconda/pkgs 1",
      "pyyaml-3.11-py27_4 /opt/continuum/anaconda/pkgs 1",
      "requests-2.10.0-py27_0 /opt/continuum/anaconda/pkgs 1",
      "ruamel_yaml-0.11.7-py27_0 /opt/continuum/anaconda/pkgs 1",
      "setuptools-23.0.0-py27_0 /opt/continuum/anaconda/pkgs 1",
      "six-1.10.0-py27_0 /opt/continuum/anaconda/pkgs 1",
      "wheel-0.29.0-py27_0 /opt/continuum/anaconda/pkgs 1",
      "conda-4.1.4-py27_0 /opt/continuum/anaconda/pkgs 1",
      "pip-8.1.2-py27_0 /opt/continuum/anaconda/pkgs 1",
      "python-dateutil-2.5.3-py27_0 /opt/continuum/anaconda/pkgs 1",
      "pandas-0.18.1-np111py27_0 /opt/continuum/anaconda/pkgs 1"
      ],
      "PREFIX": "/opt/continuum/anaconda",
    },
    "success": true
  }

创建 conda 环境

使用 .adam scale conda create

示例:在名为py3的集群上创建使用 Python 3调用的 conda 环境cluster

$ adam scale -n cluster conda create -n py3 python=3
All nodes (x4) response:
{
  "actions": {
    "LINK": [
      "openssl-1.0.2h-1 1 None",
      "readline-6.2-2 1 None",
      "sqlite-3.13.0-0 1 None",
      "tk-8.5.18-0 1 None",
      "xz-5.2.2-0 1 None",
      "zlib-1.2.8-3 1 None",
      "python-3.5.1-5 1 None",
      "setuptools-23.0.0-py35_0 1 None",
      "wheel-0.29.0-py35_0 1 None",
      "pip-8.1.2-py35_0 1 None"
    ],
    "PREFIX": "/opt/continuum/anaconda/envs/py3",
    "SYMLINK_CONDA": [
      "/opt/continuum/anaconda"
    ],
  },
  "success": true
}

更新 conda 包

使用 更新集群节点上的 conda 包 。adam scale conda update

示例:要在名为 的集群上的 root conda 环境中更新 pandas 及其依赖项cluster

$ adam scale -n cluster conda update pandas
All nodes (x4) response:
{
  "actions": {
    "LINK": [
      "pandas-0.18.1-np111py27_0 1 None"
    ],
    "PREFIX": "/opt/continuum/anaconda",
    "SYMLINK_CONDA": [
      "/opt/continuum/anaconda"
    ],
    "UNLINK": [
      "pandas-0.18.0-np111py27_0"
    ],
  },
  "success": true
}

删除 conda 包或环境

使用 删除集群节点上的 conda 包 。adam scale conda remove

示例:从名为 的集群上的根 conda 环境中删除 pandas cluster

$ adam scale -n cluster conda remove pandas
All nodes (x4) response:
{
  "actions": {
    "PREFIX": "/opt/continuum/anaconda",
    "UNLINK": [
      "pandas-0.18.1-np111py27_0"
    ],
  },
  "success": true
}

使用 删除集群节点上的 conda 环境 。adam scale conda remove

示例:删除名为py3的集群上 调用的环境cluster

$ adam scale -n cluster conda remove -n py3 --all
All nodes (x4) response:
{
  "actions": {
    "PREFIX": "/opt/continuum/anaconda/envs/py3",
    "UNLINK": [
      "openssl-1.0.2j-0",
      "pip-8.1.2-py35_0",
      "python-3.5.2-0",
      "readline-6.2-2",
      "setuptools-27.2.0-py35_0",
      "sqlite-3.13.0-0",
      "tk-8.5.18-0",
      "wheel-0.29.0-py35_0",
      "xz-5.2.2-0",
      "zlib-1.2.8-3"
    ]
  },
  "success": true
}

列出 conda 包

使用 列出集群节点上的 conda 包 。adam scale conda list

示例:要在名为 的集群上的 root conda 环境中列出 conda 包cluster

$ adam scale -n cluster conda list
All nodes (x4) response:
+-----------------+---------+--------+
| Package         | Version | Build  |
+-----------------+---------+--------+
| numpy           | 1.11.0  | py27_2 |
| conda-env       | 2.5.1   | py27_0 |
| tk              | 8.5.18  | 0      |
| pip             | 8.1.2   | py27_0 |
| readline        | 6.2     | 2      |
| setuptools      | 23.0.0  | py27_0 |
| openssl         | 1.0.2h  | 1      |
| pycosat         | 0.6.1   | py27_1 |
| python-dateutil | 2.5.3   | py27_0 |
| sqlite          | 3.13.0  | 0      |
| pytz            | 2016.4  | py27_0 |
| mkl             | 11.3.3  | 0      |
| yaml            | 0.1.6   | 0      |
| ruamel_yaml     | 0.11.7  | py27_0 |
| zlib            | 1.2.8   | 3      |
| pyyaml          | 3.11    | py27_4 |
| requests        | 2.10.0  | py27_0 |
| wheel           | 0.29.0  | py27_0 |
| python          | 2.7.11  | 5      |
| conda           | 4.1.4   | py27_0 |
| pycrypto        | 2.6.1   | py27_0 |
| six             | 1.10.0  | py27_0 |
+-----------------+---------+--------+

获取 conda 信息

使用 .adam scale conda info

示例:要查看有关名为 的集群上的 root conda 环境的信息cluster

$ adam scale -n cluster conda info
All nodes (x4) response:
Current conda install:

             platform : linux-64
        conda version : 4.1.4
    conda-env version : 2.5.1
  conda-build version : not installed
       python version : 2.7.11.final.0
     requests version : 2.10.0
     root environment : /opt/continuum/anaconda  (writable)
  default environment : /opt/continuum/anaconda
     envs directories : /opt/continuum/anaconda/envs
        package cache : /opt/continuum/anaconda/pkgs
         channel URLs : https://repo.anaconda.com/pkgs/free/linux-64/
                        https://repo.anaconda.com/pkgs/free/noarch/
                        https://repo.anaconda.com/pkgs/pro/linux-64/
                        https://repo.anaconda.com/pkgs/pro/noarch/
          config file : None
         offline mode : False
    is foreign system : False

或者查看集群节点上的 conda 环境列表:

$ adam scale -n cluster conda info -e
All nodes (x4) response:
# conda environments:
#
py27                     /opt/continuum/anaconda/envs/py27
py35                     /opt/continuum/anaconda/envs/py35
r                        /opt/continuum/anaconda/envs/r
root                  *  /opt/continuum/anaconda

使用环境定义文件管理 conda

使用以下命令管理集群节点上的 conda 环境 :adam scale env

$ adam scale -n cluster env
Usage: adam scale env [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  create  Create conda environment
  list    List conda environments
  remove  Remove conda environment
  update  Update conda environment

此功能使用 conda-env 和 conda 环境环境定义——YAML——文件。

示例:以下environment.yml文件描述了my-env使用 Python 2.7 和其他包命名的 conda 环境:

name: my-env
channels:
- defaults
dependencies:
- python=2.7.*
- bokeh
- dask
- distributed
- pandas

用于基于上述 conda 环境定义文件创建 conda 环境:adam scale env createenvironment.yml

$ adam scale -n cluster env create -f environment.yml
All nodes (x4) response:
{
  "actions": {
    "EXTRACT": [
      "msgpack-python-0.4.8-py27_0",
      "numpy-1.11.2-py27_0",
      "psutil-5.0.0-py27_0",
      "pytz-2016.7-py27_0",
      "tblib-1.3.0-py27_0",
      "python-dateutil-2.6.0-py27_0",
      "zict-0.1.0-py27_0",
      "pandas-0.19.1-np111py27_0",
      "tornado-4.4.2-py27_0",
      "bokeh-0.12.3-py27_0",
      "dask-0.12.0-py27_0",
      "distributed-1.14.1-py27_0"
    ],
    "FETCH": [
      "msgpack-python-0.4.8-py27_0",
      "numpy-1.11.2-py27_0",
      "psutil-5.0.0-py27_0",
      "pytz-2016.7-py27_0",
      "tblib-1.3.0-py27_0",
      "python-dateutil-2.6.0-py27_0",
      "zict-0.1.0-py27_0",
      "pandas-0.19.1-np111py27_0",
      "tornado-4.4.2-py27_0",
      "bokeh-0.12.3-py27_0",
      "dask-0.12.0-py27_0",
      "distributed-1.14.1-py27_0"
    ],
    "LINK": [
      "mkl-11.3.3-0 1",
      "openssl-1.0.2j-0 1",
      "readline-6.2-2 1",
      "sqlite-3.13.0-0 1",
      "tk-8.5.18-0 1",
      "yaml-0.1.6-0 1",
      "zlib-1.2.8-3 1",
      "python-2.7.12-1 1",
      "backports-1.0-py27_0 1",
      "backports_abc-0.4-py27_0 1",
      "click-6.6-py27_0 1",
      "cloudpickle-0.2.1-py27_0 1",
      "futures-3.0.5-py27_0 1",
      "heapdict-1.0.0-py27_1 1",
      "locket-0.2.0-py27_1 1",
      "markupsafe-0.23-py27_2 1",
      "msgpack-python-0.4.8-py27_0 1",
      "numpy-1.11.2-py27_0 1",
      "psutil-5.0.0-py27_0 1",
      "pytz-2016.7-py27_0 1",
      "pyyaml-3.12-py27_0 1",
      "requests-2.11.1-py27_0 1",
      "setuptools-27.2.0-py27_0 1",
      "six-1.10.0-py27_0 1",
      "tblib-1.3.0-py27_0 1",
      "toolz-0.8.0-py27_0 1",
      "wheel-0.29.0-py27_0 1",
      "chest-0.2.3-py27_0 1",
      "jinja2-2.8-py27_1 1",
      "partd-0.3.6-py27_0 1",
      "pip-9.0.1-py27_0 1",
      "python-dateutil-2.6.0-py27_0 1",
      "singledispatch-3.4.0.3-py27_0 1",
      "ssl_match_hostname-3.4.0.2-py27_1 1",
      "zict-0.1.0-py27_0 1",
      "pandas-0.19.1-np111py27_0 1",
      "tornado-4.4.2-py27_0 1",
      "bokeh-0.12.3-py27_0 1",
      "dask-0.12.0-py27_0 1",
      "distributed-1.14.1-py27_0 1"
    ],
    "PREFIX": "/opt/continuum/anaconda/envs/my-env",
    "SYMLINK_CONDA": [
      "/opt/continuum/anaconda"
    ],
    "op_order": [
      "RM_FETCHED",
      "FETCH",
      "RM_EXTRACTED",
      "EXTRACT",
      "UNLINK",
      "LINK",
      "SYMLINK_CONDA"
    ]
  },
  "success": true
}

注意:该命令仅与 conda 依赖项兼容,并忽略在 conda 环境定义文件中指定的任何 pip 或其他非 conda 依赖项。adam scale env create

使用在群集上列表畅达环境:adam scale env list

$ adam scale -n cluster env list
All nodes (x4) response:
# conda environments:
#
my-env                   /opt/continuum/anaconda/envs/my-env
root                  *  /opt/continuum/anaconda

用于根据 conda 环境定义文件更新现有 conda 环境中的包:adam scale env update

$ adam scale -n cluster env update -f environment.yml
    All nodes (x4) response:
    {
      "message": "All requested packages already installed.",
      "success": true
    }

用于从集群中删除 conda 环境:adam scale env remove

$ adam scale -n cluster env remove -n my-env
All nodes (x4) response:
{
  "actions": {
    "PREFIX": "/opt/continuum/anaconda/envs/my-env",
    "UNLINK": [
      "mkl-11.3.3-0",
      "numpy-1.11.2-py27_0",
      "openssl-1.0.2j-0",
      "pandas-0.18.0-np111py27_0",
      "pip-9.0.1-py27_0",
      "python-2.7.12-1",
      "python-dateutil-2.6.0-py27_0",
      "pytz-2016.7-py27_0",
      "readline-6.2-2",
      "setuptools-27.2.0-py27_0",
      "six-1.10.0-py27_0",
      "sqlite-3.13.0-0",
      "tk-8.5.18-0",
      "wheel-0.29.0-py27_0",
      "zlib-1.2.8-3"
    ]
  },
  "success": true
}