Skip to main content

Module checkpoint_notify

Module checkpoint_notify 

Source
Expand description

§Model Checkpoint Notification

Shared types for notifying downstream services (e.g. Forward) when the Backward service saves a new model checkpoint.

§Redis Channel

Notifications are published on fks:{instance_id}:model_checkpoints as JSON-serialised CheckpointNotification messages.

§Usage

use janus_core::checkpoint_notify::{CheckpointNotification, checkpoint_channel};

// Publisher (backward service)
let channel = checkpoint_channel("default");
let notification = CheckpointNotification::new(
    "checkpoints/backward/latest_model.bin",
    "lstm_dqn_v1",
);
let json = serde_json::to_string(&notification).unwrap();
// redis.publish(channel, json).await?;

// Subscriber (forward service)
let channel = checkpoint_channel("default");
// redis.subscribe(channel).await?;
// ... on message:
let notification: CheckpointNotification = serde_json::from_str(&payload)?;
println!("New checkpoint: {}", notification.model_path);

Structs§

CheckpointNotification
A notification emitted by the backward service when a new model checkpoint has been saved to disk.
CheckpointNotifier
Publishes model checkpoint notifications to Redis pub/sub.
CheckpointNotifierConfig
Configuration for the checkpoint notifier.

Functions§

checkpoint_channel
Returns the Redis pub/sub channel name used for model checkpoint notifications for the given instance.