Skip to content

Commit

Permalink
gRPC spec update: make resource register / unregister API calls be ca…
Browse files Browse the repository at this point in the history
…talog entry aware (#9095)
  • Loading branch information
zehiko authored Feb 20, 2025
1 parent c3c27e2 commit 31add3a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
26 changes: 16 additions & 10 deletions crates/store/re_protos/proto/rerun/v0/remote_store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ service StorageNode {

rpc UnregisterRecording(UnregisterRecordingRequest) returns (UnregisterRecordingResponse) {}

rpc UnregisterAllRecordings(UnregisterAllRecordingsRequest) returns (UnregisterAllRecordingsResponse) {}
rpc UnregisterAllRecordings(UnregisterAllRecordingsRequest)
returns (UnregisterAllRecordingsResponse) {}
}

// ---------------- Common response message ------------------
Expand Down Expand Up @@ -166,8 +167,7 @@ message CreateIndexResponse {
uint64 indexed_rows = 1;
}

message ReIndexResponse {
}
message ReIndexResponse {}

// ---------------- SearchIndex ------------------

Expand Down Expand Up @@ -213,7 +213,6 @@ message CatalogEntry {
string name = 1;
}


// ---------------- CreateManifests ------------------

// TODO(zehiko, cmc): At some point, this will need to be fully async (i.e. caller gets assigned
Expand Down Expand Up @@ -390,26 +389,33 @@ message GetRecordingSchemaResponse {
// ---------------- RegisterRecording ------------------

message RegisterRecordingRequest {
// to which catalog entry do we want to register the recording
CatalogEntry entry = 1;
// human readable description of the recording
string description = 1;
string description = 2;
// recording storage url (e.g. s3://bucket/file or file:///path/to/file)
string storage_url = 2;
string storage_url = 3;
// type of recording
RecordingType typ = 3;
RecordingType typ = 4;
// (optional) any additional metadata that should be associated with the recording
// You can associate any arbtrirary number of columns with a specific recording
DataframePart metadata = 4;
DataframePart metadata = 5;
}

// ---------------- Unregister from catalog ------------------

message UnregisterRecordingRequest {
// which catalog entry do we want to unregister the recording from
CatalogEntry entry = 1;
// unique identifier of the recording
rerun.common.v0.RecordingId recording_id = 1;
rerun.common.v0.RecordingId recording_id = 2;
}
message UnregisterRecordingResponse {}

message UnregisterAllRecordingsRequest {}
message UnregisterAllRecordingsRequest {
// which catalog entry do we want to unregister all recordings from
CatalogEntry entry = 1;
}
message UnregisterAllRecordingsResponse {}

// ---------------- UpdateCatalog -----------------
Expand Down
24 changes: 17 additions & 7 deletions crates/store/re_protos/src/v0/rerun.remote_store.v0.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/python/remote/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

elif args.subcommand == "register":
extra_metadata = pa.Table.from_pydict({"extra": [42]})
id = conn.register(args.storage_url, extra_metadata)
id = conn.register("default", args.storage_url, extra_metadata)
print(f"Registered new recording with ID: {id}")

elif args.subcommand == "update":
Expand Down
4 changes: 3 additions & 1 deletion rerun_py/rerun_bindings/rerun_bindings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,14 @@ class StorageNodeClient:
"""
...

def register(self, storage_url: str, metadata: Optional[TableLike] = None) -> str:
def register(self, entry: str, storage_url: str, metadata: Optional[TableLike] = None) -> str:
"""
Register a recording along with some metadata.
Parameters
----------
entry : str
Catalog entry in which to register the recording in.
storage_url : str
The URL to the storage location.
metadata : Optional[Table | RecordBatch]
Expand Down
13 changes: 12 additions & 1 deletion rerun_py/src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,24 @@ impl PyStorageNodeClient {
///
/// Parameters
/// ----------
/// entry : str
/// Catalog entry in which to register the recording in.
/// storage_url : str
/// The URL to the storage location.
/// metadata : Optional[Table | RecordBatch]
/// A pyarrow Table or RecordBatch containing the metadata to update.
/// This Table must contain only a single row.
#[pyo3(signature = (
entry,
storage_url,
metadata = None
))]
fn register(&mut self, storage_url: &str, metadata: Option<MetadataLike>) -> PyResult<String> {
fn register(
&mut self,
entry: &str,
storage_url: &str,
metadata: Option<MetadataLike>,
) -> PyResult<String> {
self.runtime.block_on(async {
let storage_url = url::Url::parse(storage_url)
.map_err(|err| PyRuntimeError::new_err(err.to_string()))?;
Expand All @@ -336,6 +344,9 @@ impl PyStorageNodeClient {
.transpose()?;

let request = RegisterRecordingRequest {
entry: Some(CatalogEntry {
name: entry.to_owned(),
}),
// TODO(jleibs): Description should really just be in the metadata
description: Default::default(),
storage_url: storage_url.to_string(),
Expand Down

0 comments on commit 31add3a

Please sign in to comment.