Skip to content

Commit

Permalink
wait for webgraph to come online when instantiating remote webgraph conn
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkeldenker committed Aug 29, 2024
1 parent 710b42f commit e8875fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions crates/core/src/webgraph/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion ltr/linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit e8875fe

Please sign in to comment.