From 51bdadc92a76e4bcc4b36ebd10bff4f9715b4b6a Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Wed, 29 May 2024 17:04:02 +0400 Subject: [PATCH] Change daemon embeddings healthcheck query threshold from 1000 to 2000 --- model/lantern/lantern_doctor_query.rb | 2 +- spec/model/lantern/lantern_doctor_query_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model/lantern/lantern_doctor_query.rb b/model/lantern/lantern_doctor_query.rb index 0b02f42c8..f30054ea9 100644 --- a/model/lantern/lantern_doctor_query.rb +++ b/model/lantern/lantern_doctor_query.rb @@ -145,7 +145,7 @@ def check_daemon_embedding_jobs(db, query_user) lantern_server = doctor.resource.representative_server failed = jobs.any? do |job| - res = lantern_server.run_query("SELECT (SELECT COUNT(*) FROM \"#{job[:schema]}\".\"#{job[:table]}\" WHERE \"#{job[:src_column]}\" IS NOT NULL AND \"#{job[:src_column]}\" != '' AND \"#{job[:src_column]}\" != 'Error: Summary failed (llm)' AND \"#{job[:dst_column]}\" IS NULL) > 1000", db: db, user: query_user).strip + res = lantern_server.run_query("SELECT (SELECT COUNT(*) FROM \"#{job[:schema]}\".\"#{job[:table]}\" WHERE \"#{job[:src_column]}\" IS NOT NULL AND \"#{job[:src_column]}\" != '' AND \"#{job[:src_column]}\" != 'Error: Summary failed (llm)' AND \"#{job[:dst_column]}\" IS NULL) > 2000", db: db, user: query_user).strip res == "t" end diff --git a/spec/model/lantern/lantern_doctor_query_spec.rb b/spec/model/lantern/lantern_doctor_query_spec.rb index 41b4152f1..879f5abcb 100644 --- a/spec/model/lantern/lantern_doctor_query_spec.rb +++ b/spec/model/lantern/lantern_doctor_query_spec.rb @@ -392,7 +392,7 @@ where: instance_double(Sequel::Dataset, where: instance_double(Sequel::Dataset, all: [{schema: "public", table: "test", src_column: "test-src", dst_column: "test-dst"}])))))) - expect(serv).to receive(:run_query).with("SELECT (SELECT COUNT(*) FROM \"public\".\"test\" WHERE \"test-src\" IS NOT NULL AND \"test-src\" != '' AND \"test-src\" != 'Error: Summary failed (llm)' AND \"test-dst\" IS NULL) > 1000", db: "postgres", user: "postgres").and_return("t") + expect(serv).to receive(:run_query).with("SELECT (SELECT COUNT(*) FROM \"public\".\"test\" WHERE \"test-src\" IS NOT NULL AND \"test-src\" != '' AND \"test-src\" != 'Error: Summary failed (llm)' AND \"test-dst\" IS NULL) > 2000", db: "postgres", user: "postgres").and_return("t") expect(lantern_doctor_query.check_daemon_embedding_jobs("postgres", "postgres")).to eq("t") end @@ -426,7 +426,7 @@ where: instance_double(Sequel::Dataset, where: instance_double(Sequel::Dataset, all: [{schema: "public", table: "test", src_column: "test-src", dst_column: "test-dst"}])))))) - expect(serv).to receive(:run_query).with("SELECT (SELECT COUNT(*) FROM \"public\".\"test\" WHERE \"test-src\" IS NOT NULL AND \"test-src\" != '' AND \"test-src\" != 'Error: Summary failed (llm)' AND \"test-dst\" IS NULL) > 1000", db: "postgres", user: "postgres").and_return("f") + expect(serv).to receive(:run_query).with("SELECT (SELECT COUNT(*) FROM \"public\".\"test\" WHERE \"test-src\" IS NOT NULL AND \"test-src\" != '' AND \"test-src\" != 'Error: Summary failed (llm)' AND \"test-dst\" IS NULL) > 2000", db: "postgres", user: "postgres").and_return("f") expect(lantern_doctor_query.check_daemon_embedding_jobs("postgres", "postgres")).to eq("f") end