Advertise all catalog workloads from the worker by default
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/emil28092005/SciMesh/coordinator/internal/workloads"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is read only from the environment, mirroring the former Python
|
// Config is read only from the environment, mirroring the former Python
|
||||||
@@ -99,7 +101,7 @@ func LoadConfig() (*Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(capabilities) == 0 {
|
if len(capabilities) == 0 {
|
||||||
capabilities = []string{"similarity-search", "similarity_search"}
|
capabilities = defaultCapabilities()
|
||||||
}
|
}
|
||||||
runner, err := envList("TASK_RUNNER")
|
runner, err := envList("TASK_RUNNER")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -157,3 +159,19 @@ func durationEnv(name string, fallback time.Duration) (time.Duration, error) {
|
|||||||
}
|
}
|
||||||
return parsed, nil
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ SciMesh manual demo is ready.
|
|||||||
|
|
||||||
Sign in with the admin above, or register a new account from the login page.
|
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
|
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:
|
Worker logs are in $logs_dir. Stop everything with:
|
||||||
|
|
||||||
make demo-down
|
make demo-down
|
||||||
|
|||||||
Reference in New Issue
Block a user