Labels and Variables

Maand smartly generates variables for workers based on labels and attributes.


These variables generated to simplify service discovery, labels-based configuration, and worker-specific customizations.

Example workers.json file

[
 {
   "host": "10.27.221.181",
   "labels": ["prometheus"]
 },
 {
   "host": "10.27.221.144"
 },
 {
   "host": "10.27.221.170"
 }
]

based on example workers.json file, following variables are generated

Variables


Examples

Worker 10.27.221.181:

This worker has the labels worker and prometheus:

WORKER_0=10.27.221.181 
WORKER_1=10.27.221.144 
WORKER_2=10.27.221.170
WORKER_INDEX=0 
WORKER_IP=10.27.221.181
WORKER_WORKERS=10.27.221.181,10.27.221.144,10.27.221.170
PROMETHEUS_0=10.27.221.181
PROMETHEUS_INDEX=0
PROMETHEUS_WORKERS=10.27.221.181
LABELS=worker,prometheus

Worker 10.27.221.144:

This worker has only the worker label:

WORKER_0=10.27.221.181
WORKER_1=10.27.221.144
WORKER_2=10.27.221.170
WORKER_INDEX=1
WORKER_IP=10.27.221.144
WORKER_WORKERS=10.27.221.181,10.27.221.144,10.27.221.170
PROMETHEUS_WORKERS=10.27.221.181
LABELS=worker

Worker 10.27.221.170:

This worker has only the worker label:

WORKER_0=10.27.221.181
WORKER_1=10.27.221.144
WORKER_2=10.27.221.170
WORKER_INDEX=2
WORKER_IP=10.27.221.170
WORKER_WORKERS=10.27.221.181,10.27.221.144,10.27.221.170
PROMETHEUS_WORKERS=10.27.221.181
LABELS=worker

Usage in Jobs

These variables allow dynamic behavior in jobs:

This approach ensures scalability and simplifies multi-agent orchestration!