You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the command OCTO.UPLOAD {file_name} on a Redis replica, the following error occurs:
== CRITICAL == This replica is sending an error to its master: '-only master can upload model' after processing the command 'OCTO.UPLOAD'
Latest backlog is: '"\n$18\r\n__sentinel__:hello\r\n$87\r\n10.1.14.4,36379,94668a13ba037b093bba73fae61e333cff0ed95f,89,master01,10.1.8.235,6379,89\r\n*3\r\n$7\r\nPUBLISH\r\n$18\r\n__sentinel__:hello\r\n$87\r\n10.1.14.4,36379,94668a13ba037b093bba73fae61e333cff0ed95f,89,master01,10.1.8.235,6379,89\r\n"'
Code:
fn upload_model(ctx: &Context, args: Vec<RedisString>) -> RedisResult {
if args.len() != 2 {
return Err(RedisError::WrongArity);
};
if !ctx.get_flags().contains(ContextFlags::MASTER) {
return Err(RedisError::Str("only master can upload model"));
}
let mut args = args.into_iter().skip(1);
let file_name = args.next_string()?;
ctx.replicate_verbatim();
let key = RedisString::create(NonNull::new(ctx.ctx), file_name.as_str());
let status = ctx.notify_keyspace_event(NotifyEvent::GENERIC, "model.upload", &key);
match status {
Status::Ok => REDIS_OK,
Status::Err => Err(RedisError::Str("fail send event")),
}
}
fn event_upload_model(ctx: &Context, event_type: NotifyEvent, event: &str, key: &[u8]) {
let msg = format!(
"Received event: {:?} on key: {} via event: {}",
event_type,
std::str::from_utf8(key).unwrap(),
event
);
let file_name = std::str::from_utf8(key).unwrap().to_string();
ctx.log_notice(msg.as_str());
std::thread::spawn(move || {
match catboost::upload_catboost_model(
std::env::temp_dir().join(format!("models/{}", file_name)),
) {
Ok(model) => {
*catboost::CATBOOST_MODEL.lock().unwrap() = model;
*catboost::CATBOOST_VERSION.lock().unwrap() = file_name.clone();
}
Err(err) => {
error!(
"Error updating CatBoost model with file '{}': {}",
file_name.to_string().clone(),
err
);
}
};
});
}
redis_module! {
name: crate::MODULE_NAME,
version: 1,
allocator: (get_allocator!(), get_allocator!()),
data_types: [CREATIVE_CONDITION],
init:init,
commands: [
["OCTO.UPLOAD", upload_model, "readonly", 1, 1, 1],
],
event_handlers: [
[@GENERIC: event_upload_model],
],
}
How can I perform a model update on replicas using notifications? Redis version=7.2.4 redis-module = "2.0.7
When running the command
OCTO.UPLOAD {file_name}
on a Redis replica, the following error occurs:Code:
How can I perform a model update on replicas using notifications?
Redis version=7.2.4
redis-module = "2.0.7
Docker-compose
The text was updated successfully, but these errors were encountered: