Skip to content

web search done right

wait for webgraph to come online when instantiating remote webgraph conn

Mikkel Denkere8875fe19d0c
diff --git a/crates/core/src/webgraph/remote.rs b/crates/core/src/webgraph/remote.rs
index ecc7b2eb..5d691563 100644
--- a/crates/core/src/webgraph/remote.rs
+++ b/crates/core/src/webgraph/remote.rs
@@ -98,6 +98,23 @@ impl RemoteWebgraph {
pub async fn new(cluster: Arc<Cluster>, granularity: WebgraphGranularity) -> Self {
let manager = WebgraphClientManager { granularity };
+ tracing::info!("waiting for {granularity} webgraph to come online...");
+
+ cluster
+ .await_member(|member| {
+ if let Service::Webgraph {
+ host: _,
+ shard: _,
+ granularity: remote_granularity,
+ } = member.service
+ {
+ granularity == remote_granularity
+ } else {
+ false
+ }
+ })
+ .await;
+
Self {
client: Arc::new(Mutex::new(
sonic::replication::ReusableShardedClient::new(cluster, manager).await,
diff --git a/ltr/linear_model.py b/ltr/linear_model.py
index 798d35e9..794dec68 100644
--- a/ltr/linear_model.py
+++ b/ltr/linear_model.py
@@ -91,7 +91,7 @@ def eval_query(query, expected_urls, weights):
if len(weights) != 0:
coeffs = {id2feature[i]: w for i, w in enumerate(weights)}
- coeffs["lambda_mart"] = 10.0
+ coeffs["lambda_mart"] = 1000.0
res = stract.search(query, signal_coefficients=coeffs)
return sum([1 for r in res if r["url"] in expected_urls])