Advertise all catalog workloads from the worker by default

This commit is contained in:
Emil
2026-08-02 17:47:52 +03:00
parent 749396da05
commit 361eb2e344
2 changed files with 20 additions and 2 deletions
+19 -1
View File
@@ -8,6 +8,8 @@ import (
"strconv"
"strings"
"time"
"github.com/emil28092005/SciMesh/coordinator/internal/workloads"
)
// Config is read only from the environment, mirroring the former Python
@@ -99,7 +101,7 @@ func LoadConfig() (*Config, error) {
return nil, err
}
if len(capabilities) == 0 {
capabilities = []string{"similarity-search", "similarity_search"}
capabilities = defaultCapabilities()
}
runner, err := envList("TASK_RUNNER")
if err != nil {
@@ -157,3 +159,19 @@ func durationEnv(name string, fallback time.Duration) (time.Duration, error) {
}
return parsed, nil
}
// defaultCapabilities derives the worker's advertised capabilities from the
// embedded workload catalog, so an agent is workload-agnostic out of the box:
// it claims whatever enabled workloads the coordinator library declares.
// Explicit CAPABILITIES still overrides this for operators who want a subset.
func defaultCapabilities() []string {
catalog, err := workloads.Load()
if err != nil {
return []string{"similarity-search"}
}
names := make([]string, 0, len(catalog.Enabled()))
for _, workload := range catalog.Enabled() {
names = append(names, workload.Name)
}
return names
}
+1 -1
View File
@@ -201,7 +201,7 @@ SciMesh manual demo is ready.
Sign in with the admin above, or register a new account from the login page.
The admin sees every job; a plain user sees only their own. Upload a small
ChEMBL TSV through “New similarity search”, then watch the job page update.
ChEMBL TSV through the "New computation" form, then watch the job page update.
Worker logs are in $logs_dir. Stop everything with:
make demo-down