Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecc8944006 | ||
|
|
dc15e2d04b | ||
|
|
ff1fc25d77 |
@@ -38,6 +38,14 @@
|
||||
## Plan (предыдущая задача — выполнена)
|
||||
1–7. Docker E2E пайплайна «install как человек → serve → визард → воркер → джоб» — выполнено, см. Progress ниже.
|
||||
|
||||
## Progress (день: конкурентность в агенте — параллелизм через нашу архитектуру)
|
||||
- ✅ По просьбе «реализовать параллелизм через нашу архитектуру»: `WORKER_CONCURRENCY` (поле `concurrency` в конфиге визарда, шаг Machine) — агент регистрируется один раз и ведёт N циклов claim→выполнение→upload под одним worker id. N шардов обрабатываются параллельно на одной машине, используя таски координатора как единицу параллелизма; SDK не менялся.
|
||||
- ✅ Реализация: `Config.Concurrency` + env; `Daemon.RunForever` → register once → N goroutine-циклов (общий счётчик MaxTasks под мьютексом); визард: поле «Concurrent task loops» + конфиг; тест с маркер-скриптом доказывает 3 параллельных исполнения (race-тесты зелёные после мьютекса в fake).
|
||||
- ✅ Измерено на релизном коде в Docker (один воркер, 8 шардов): concurrency=1 → 12s; concurrency=4 → 4s (**3×**). Плюс прежний `similarity-search-parallel` (потоки внутри шарда) композируется с конкурентностью.
|
||||
- ✅ Релиз v1.1.0-alpha.20 (бинарники + wheel); полный гейт: race + lint 0 issues + pytest 213.
|
||||
- ✅ Бинарник worker-agent на машине пользователя обновлён до alpha.20.
|
||||
- GIL-высвобождения в RDKit нет (проверено: `RDKIT_ALLOW_GIL_RELEASE` не помогает), поэтому внутришардовые потоки не ускоряют чистый RDKit-путь — конкурентность задач это и компенсирует.
|
||||
|
||||
## Progress (утро: similarity-search-parallel)
|
||||
- ✅ Новый workload `similarity-search-parallel@1.0.0` (отдельная версия, как просил пользователь): подкласс `SimilaritySearchSDKWorkload` + параллельное ядро `search_parallel/core.py` — fingerprinting+скоринг шарда через `ThreadPoolExecutor` (параметр `threads`, default CPU count); `pool.map` сохраняет порядок строк, поэтому merge идентичен последовательному (`_HeapEntry`) и результат **байт-в-байт** равен `similarity-search` при любом числе потоков.
|
||||
- ✅ Тесты: байт-в-байт vs эталон для threads 1/2/4 с намеренными связями (изомеры, дубликаты), executor-прогон, валидация параметров, регистрация манифеста; 213 pytest зелёные.
|
||||
|
||||
@@ -88,8 +88,10 @@ func CheckEnvironment(ctx context.Context) CheckReport {
|
||||
// execute with.
|
||||
func CheckEnvironmentWithPython(ctx context.Context, python string) CheckReport {
|
||||
report := CheckReport{Agent: Version, Python: CheckItem{Name: "python", OK: true, Detail: python}}
|
||||
// The version comes from importlib.metadata, so the wizard can compare the
|
||||
// installed package with the binary version and offer an upgrade.
|
||||
//nolint:gosec // G204: python is a resolved interpreter path, the argument list is constant
|
||||
cmd := exec.CommandContext(ctx, python, "-c", "import scimesh; print(scimesh.__version__ if hasattr(scimesh, '__version__') else 'installed')")
|
||||
cmd := exec.CommandContext(ctx, python, "-c", "import importlib.metadata as m; print(m.version('scimesh'))")
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
// The worker executes workloads by spawning scimesh's task runner, so
|
||||
|
||||
@@ -454,6 +454,9 @@ func (s *Server) handleTest(w http.ResponseWriter, r *http.Request) {
|
||||
// checking the bare system python3 would keep reporting scimesh as
|
||||
// missing even though the worker would run with the venv.
|
||||
report := agent.RunCheck(r.Context(), url, s.venvPython(), req.Token, req.WorkerKey, req.UserserviceURL)
|
||||
if report.Scimesh.OK {
|
||||
report.Scimesh = ensureMatchingScimeshVersion(report.Scimesh)
|
||||
}
|
||||
writeJSON(w, http.StatusOK, report)
|
||||
}
|
||||
|
||||
@@ -628,3 +631,26 @@ func truncate(s string, n int) string {
|
||||
}
|
||||
return s[:n] + "…"
|
||||
}
|
||||
|
||||
// ensureMatchingScimeshVersion flips a green scimesh check to a stale one when
|
||||
// the installed package does not match the worker-agent's own version: a
|
||||
// version-locked wheel is the only supported runtime, and a mismatch means the
|
||||
// workload catalog the worker advertises is not what it executes. The wizard
|
||||
// UI then offers the Install button again. Dev builds have no release wheel,
|
||||
// so they skip the comparison.
|
||||
func ensureMatchingScimeshVersion(item agent.CheckItem) agent.CheckItem {
|
||||
if agent.Version == "" || agent.Version == "dev" {
|
||||
return item
|
||||
}
|
||||
want := agent.NormalizePEP440(agent.Version)
|
||||
got := strings.TrimSpace(item.Detail)
|
||||
if got == "" || got == want {
|
||||
return item
|
||||
}
|
||||
item.OK = false
|
||||
item.Detail = fmt.Sprintf(
|
||||
"installed scimesh %s, but this worker-agent (%s) needs %s — press Install to upgrade",
|
||||
got, agent.Version, want,
|
||||
)
|
||||
return item
|
||||
}
|
||||
|
||||
@@ -497,3 +497,26 @@ time=6 level=WARN msg="agent cycle failed" error="boom"
|
||||
t.Errorf("stats = %+v, want registered claimed=2 completed=1 failed=1", stats)
|
||||
}
|
||||
}
|
||||
|
||||
func testCheckScimeshVersion(t *testing.T, installed, binary string, wantOK bool, wantDetail string) {
|
||||
t.Helper()
|
||||
old := agent.Version
|
||||
agent.Version = binary
|
||||
t.Cleanup(func() { agent.Version = old })
|
||||
item := ensureMatchingScimeshVersion(agent.CheckItem{Name: "scimesh", OK: true, Detail: installed})
|
||||
if item.OK != wantOK {
|
||||
t.Errorf("installed=%s binary=%s: ok=%v, want %v (%s)", installed, binary, item.OK, wantOK, item.Detail)
|
||||
}
|
||||
if wantDetail != "" && !strings.Contains(item.Detail, wantDetail) {
|
||||
t.Errorf("detail = %q, want it to contain %q", item.Detail, wantDetail)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnsureMatchingScimeshVersion(t *testing.T) {
|
||||
testCheckScimeshVersion(t, "1.1.0a20", "1.1.0-alpha.20", true, "")
|
||||
testCheckScimeshVersion(t, "1.1.0a17", "1.1.0-alpha.20", false, "press Install to upgrade")
|
||||
testCheckScimeshVersion(t, "1.1.0a16.dev7+gea0fb8c59.d20260803", "1.1.0-alpha.20", false, "needs 1.1.0a20")
|
||||
// Dev builds and unknown versions never block.
|
||||
testCheckScimeshVersion(t, "anything", "dev", true, "")
|
||||
testCheckScimeshVersion(t, "1.1.0a20", "", true, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user