#conda #server #rattler #environment #http #fly #cache

app rattler-server

一个用于使用rattler解决conda环境的服务器

1 个不稳定版本

0.3.0 2024年1月13日

#157缓存

Apache-2.0

43KB
862 代码行

rattler-server: 动态解决conda环境

rattler-server 是一个针对HTTP端点解决conda环境的单一用途工具。该工具使用来自底层 rattler 库的crate。

如果您想了解更多信息,请加入我们的 Discord!

特性

  • 用Rust编写,内存安全且快速!
  • 使用axum进行异步、并行请求执行
  • 使用libsolv进行快速缓存,并可配置缓存生命周期
  • 使用与 mamba 相同的包解析算法

命令行界面

如果您克隆此存储库,可以使用以下方法运行 rattler-server

# run rattler-server on default port 3000
cargo run

# or to run on another port (3322)
cargo run -- -p 3322

完整的帮助文本如下

Usage: rattler-server [OPTIONS]

Options:
  -p <PORT>
          The port at which the server should listen [env: RATTLER_SERVER_PORT=] [default: 3000]
  -c <CONCURRENT_REPODATA_DOWNLOADS_PER_REQUEST>
          The amount of concurrent downloads of repodata.json files, during a single request. JSON downloads are very CPU-intensive, because they require parsing huge JSON bodies [env: RATTLER_SERVER_PORT_CONCURRENT_DOWNLOADS=] [default: 1]
  -r <REPODATA_CACHE_EXPIRATION_SECONDS>
          The amount of seconds after which a cached repodata.json expires, defaults to 30 minutes [env: RATTLER_SERVER_CACHE_EXPIRATION_SECONDS=] [default: 1800]
  -h, --help
          Print help

端点

它有一个单一端点(/solve),接受以下JSON内容的HTTP POST请求

{
  "specs": [
    "cudnn",
    "tensorflow-gpu"
  ],
  "virtual_packages": ["__glibc=2.5=0", "__cuda=11=0"],
  "channels": [
    "conda-forge"
  ],
  "platform": "linux-64"
}

如果成功,服务器将以HTTP 200响应回复该环境的解决、拓扑排序依赖项,例如

{
  "packages": [
    {
      "name": "_libgcc_mutex",
      "version": "0.1",
      "build": "conda_forge",
      "build_number": 0,
      "subdir": "linux-64",
      "md5": "d7c89558ba9fa0495403155b64376d81",
      "sha256": "fe51de6107f9edc7aa4f786a70f4a883943bc9d39b3bb7307c04c41410990726",
      "size": 2562,
      "depends": [],
      "constrains": [],
      "license": "None",
      "timestamp": 1578324546067,
      "fn": "_libgcc_mutex-0.1-conda_forge.tar.bz2",
      "url": "https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2",
      "channel": "https://conda.anaconda.org/conda-forge/"
    },
    {
      "name": "libgomp",
      "version": "12.2.0",
      "build": "h65d4601_19",
      "build_number": 19,
      "subdir": "linux-64",
      "md5": "cedcee7c064c01c403f962c9e8d3c373",
      "sha256": "81a76d20cfdee9fe0728b93ef057ba93494fd1450d42bc3717af4e468235661e",
      "size": 466188,
      "depends": [
        "_libgcc_mutex 0.1 conda_forge"
      ],
      "constrains": [],
      "license": "GPL-3.0-only WITH GCC-exception-3.1",
      "license_family": "GPL",
      "timestamp": 1666519598453,
      "fn": "libgomp-12.2.0-h65d4601_19.tar.bz2",
      "url": "https://conda.anaconda.org/conda-forge/linux-64/libgomp-12.2.0-h65d4601_19.tar.bz2",
      "channel": "https://conda.anaconda.org/conda-forge/"
    },
    // ... and many more
  ]
}

如果您请求一个不可解决的问题(例如,使用旧的 __glibc=1.0=0 虚拟包),则返回以下内容的HTTP 409响应

{
  "error_kind": "solver",
  "message": "no solution found for the specified dependencies",
  "additional_info": [
    "nothing provides __glibc >=2.17,<3.0.a0 needed by cudnn-8.2.0.53-h86fa8c9_0"
  ]
}

依赖项

~25–44MB
~711K SLoC