Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of ExeUnit directory and runtime descriptor #2870

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/provider/exe-unit/exe-units.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# ExeUnits

## How Provider agent finds ExeUnits?

`ya-provider` lists available ExeUnits by listing descriptors placed in [directory](../overview.md#provider-directories).

Example directory content:
```commandline
nieznanysprawiciel@laptop:~$ tree ~/.local/lib/yagna/plugins
/home/nieznanysprawiciel/.local/lib/yagna/plugins
├── exe-unit
├── ya-runtime-vm
│   ├── runtime
│   │   ├── bios-256k.bin
│   │   ├── efi-virtio.rom
│   │   ├── initramfs.cpio.gz
│   │   ├── kvmvapic.bin
│   │   ├── linuxboot_dma.bin
│   │   ├── self-test.gvmi
│   │   ├── vmlinuz-virt
│   │   └── vmrt
│   └── ya-runtime-vm
├── ya-runtime-vm.json
├── ya-runtime-wasi
└── ya-runtime-wasi.json
```
ExeUnit descriptors (`ya-runtime-vm.json` and `ya-runtime-wasi.json`) must be placed directly in plugins directory (not in nested structure).
Other ExeUnits' files can be moved into subdirectories, because descriptor is pointing to specific files.

## Descriptor

Example ExeUnit descriptor:
```json
[
{
"name": "custom",
"version": "0.2.2",
"supervisor-path": "exe-unit",
"runtime-path": "custom-runtime/custom",
"description": "Custom runtime for documentation purposes.",
"extra-args": ["--runtime-managed-image"],
"properties": {
"golem.custom-runtime.enable" : false,
"golem.custom-runtime.config" : {
"value": 32
}
},
"config": {
"counters": {
"golem.usage.network.in-mib": {
"name": "in-network-traffic",
"description": "Incoming network traffic usage in MiB",
"price": true
},
"golem.usage.network.out-mib": {
"name": "out-network-traffic",
"description": "Outgoing network traffic usage in MiB",
"price": true
},
"golem.usage.duration_sec": {
"name": "duration",
"description": "Activity duration in seconds",
"price": true
}
}
}
}
]
```


| property | optional | description |
|-----------------|----------|---------------------------------------------------------------------------------------------------------------------------------|
| name | No | Runtime name which will be placed in offer as `"golem.runtime.name"` |
| version | No | Runtime version following semantic versioning. Placed in Offer as `golem.runtime.version` |
| supervisor-path | No | Path to supervisor binary relative to this descriptor. |
| runtime-path | Yes | Path to runtime binary relative to this descriptor. |
| description | Yes | Human readable runtime description. |
| extra-args | Yes | Runtime specific arguments that will be appended to ExeUnit binary when starting. |
| properties | Yes | Properties that will be attached to Offer. Dictionary with keys used as a path in Offer which value can be any legal json type. |
| config | Yes | Runtime configuration that can be used by Provider. |
| config/counters | Yes | Dictionary of supported usage counters. |
18 changes: 9 additions & 9 deletions docs/provider/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ To change default runtimes versions set env variables:
Standard Provider installation uses files in following directories:


| name | ENV | command line | default configuration | description | comment |
| ----------------------- | ------------- | --------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Yagna data directory | YAGNA_DATADIR | yagna --datadir | ~/.local/share/yagna | Contains yagna daemon configuration and persistent files. | |
| Provider data directory | DATADIR | ya-provider --datadir | ~/.local/share/ya-provider | Provider agent configuration files, logs and ExeUnit directories. | |
| name | ENV | command line | default configuration | description | comment |
| ----------------------- | ------------- | --------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Yagna data directory | YAGNA_DATADIR | yagna --datadir | ~/.local/share/yagna | Contains yagna daemon configuration and persistent files. | |
| Provider data directory | DATADIR | ya-provider --datadir | ~/.local/share/ya-provider | Provider agent configuration files, logs and ExeUnit directories. | |
| Runtimes directory | EXE_UNIT_PATH | ya-provider --exe-unit-path | ~/.local/lib/yagna/plugins/ya-*.json | Contains runtime binaries. | Regular expression pointing to ExeUnits descriptors (It's not directory). Warning:`golemsp` overrides this setting (issue: [#2689](https://github.com/golemfactory/yagna/issues/2689)). |
| ExeUnit cache | | | ~/.local/share/ya-provider/exe-unit/cache | Stores cached ExeUnit Runtime images. | |
| ExeUnit working dir | | | ~/.local/share/ya-provider/exe-unit/work | Directory used to store tasks data. For each Agreement ExeUnit creates directory named by Agreement Id. Inside there are directories created for each activity. VM runtime mounts image volumes inside this directory. | |
| Binaries | | | ~/.local/bin/yagna | Yagna daemon and agent binaries. | If yagna is already installed, installer will use previous directory instead. |
| Installer files | | | ~/.local/share/ya-installer | Directory used by installer to download files. | Files can be removed after installation is completed. |
| GSB unix socket | GSB_URL | | unix:/tmp/yagna.sock | Unix socket used by GSB for communication. | Can be configured to use TCP. |
| ExeUnit cache | | | ~/.local/share/ya-provider/exe-unit/cache | Stores cached ExeUnit Runtime images. | Always relative to Provider data directory `${YAGNA_DATADIR}/exe-unit/cache`. |
| ExeUnit working dir | | | ~/.local/share/ya-provider/exe-unit/work | Directory used to store tasks data. For each Agreement ExeUnit creates directory named by Agreement Id. Inside there are directories created for each activity. VM runtime mounts image volumes inside this directory. | Always relative to Provider data directory `${YAGNA_DATADIR}/exe-unit/work`. |
| Binaries | | | ~/.local/bin/yagna | Yagna daemon and agent binaries. | If yagna is already installed, installer will use previous directory instead. |
| Installer files | | | ~/.local/share/ya-installer | Directory used by installer to download files. | Files can be removed after installation is completed. |
| GSB unix socket | GSB_URL | | unix:/tmp/yagna.sock | Unix socket used by GSB for communication. | Can be configured to use TCP. |
Loading