Skip to main content

Hestia 用于编排模型的模块。

项目描述

Hestia 引擎编排器

编排您的不同模型以在周期、影响评估或站点上运行。

文档

文档可以在源文件夹中找到。

安装

  1. 安装库:
pip install hestia_earth.orchestrator

您现在可以安装自己的模型或按照以下步骤使用默认的 Hestia 模型。

安装 Hestia 模型

如果要使用hestia 默认模型,请按照下列步骤操作:

  1. 安装库:
pip install hestia_earth.models
  1. 下载最新的配置文件:
curl https://gitlab.com/hestia-earth/hestia-engine-orchestrator/-/raw/master/scripts/download_config.sh?inline=false -o download_config.sh && chmod +x download_config.sh
# pip default install directory is /usr/local/lib/python<version>/site-packages
./download_config.sh <pip install directory>

使用自己的模型

除了(或代替)Hestia 提供的默认模型集之外,您还可以创建自己的模型。

该模型只需要公开一种方法:

def run(key: str, data): ...

它将获得已提供给协调器的数据,即通过调用:

from hestia_earth.orchestrator import run

my_data = {'@type': 'Cycle', 'inputs': []}
config = {
  "models": [{
    "key": "inputs",
    "model": "my_model",
    "value": "my_model_value",
    "runStrategy": "add_if_missing_key"
  }]
}
run(my_data, config)

将调用您自己的模型my_model.py

def run('my_model_value', my_data: dict): ...

用法

# will work with either Cycle or Site
from hestia_earth.orchestrator import run

# cycle is a JSONLD node cycle
cycle = {'@type': 'Cycle', ...}
result = run(cycle, '/path/to/my-config.json')  # configuration stored in a file
print(result)

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

hestia-earth-orchestrator-0.3.3.tar.gz (26.5 kB 查看哈希

已上传 source

内置分布

hestia_earth_orchestrator-0.3.3-py3-none-any.whl (34.1 kB 查看哈希

已上传 py3