From 045e07dacdd3a4348bedbd89bde7b20aca6ca90d Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Wed, 29 May 2024 02:39:55 +0400 Subject: [PATCH 1/2] Update filter for getting embeddings that are not generated from daemon jobs --- model/lantern/lantern_doctor_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/lantern/lantern_doctor_query.rb b/model/lantern/lantern_doctor_query.rb index 4a572bdcc..0b02f42c8 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[: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) > 1000", db: db, user: query_user).strip res == "t" end From 8da6c9c244b807272458ae23e38940d1b9ba7da5 Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Wed, 29 May 2024 02:45:31 +0400 Subject: [PATCH 2/2] Update tests for daemon embedding job check --- spec/model/lantern/lantern_doctor_query_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/model/lantern/lantern_doctor_query_spec.rb b/spec/model/lantern/lantern_doctor_query_spec.rb index 33f8aaa1b..41b4152f1 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-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) > 1000", 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-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) > 1000", db: "postgres", user: "postgres").and_return("f") expect(lantern_doctor_query.check_daemon_embedding_jobs("postgres", "postgres")).to eq("f") end