Skip to content

Commit 3c5569b

Browse files
authored
SDK: add do-global-maintenance operation (#11184)
### Related * Follow up to #11176 * Related to rr-1930 ### What Add SDK suppoort for issuing global maintenance operations on the redap server. ### Testing tested manually on my local rerun cloud server with: ```py client = rr.catalog.CatalogClient(address="rerun+http://localhost:51234") client.do_global_maintenance() ``` Signed-off-by: Andrea Reale <[email protected]>
1 parent c3ee3ba commit 3c5569b

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

crates/store/re_redap_client/src/connection_client.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,14 @@ where
377377

378378
Ok(())
379379
}
380+
381+
pub async fn do_global_maintenance(&mut self) -> Result<(), StreamError> {
382+
self.inner()
383+
.do_global_maintenance(tonic::Request::new(
384+
re_protos::cloud::v1alpha1::DoGlobalMaintenanceRequest {},
385+
))
386+
.await?;
387+
388+
Ok(())
389+
}
380390
}

rerun_py/rerun_bindings/rerun_bindings.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,6 +1741,10 @@ class CatalogClientInternal:
17411741

17421742
# ---
17431743

1744+
def do_global_maintenance(self) -> None: ...
1745+
1746+
# ---
1747+
17441748
def _entry_id_from_entry_name(self, name: str) -> EntryId: ...
17451749

17461750
class DataFusionTable:

rerun_py/rerun_sdk/rerun/catalog.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ def register_table(self, name: str, url: str) -> TableEntry:
179179
"""
180180
return self._raw_client.register_table(name, url)
181181

182+
def do_global_maintenance(self) -> None:
183+
"""Perform maintenance tasks on the whole system."""
184+
return self._raw_client.do_global_maintenance()
185+
182186
@property
183187
def ctx(self) -> datafusion.SessionContext:
184188
"""Returns a DataFusion session context for querying the catalog."""

rerun_py/src/catalog/catalog_client.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,17 @@ impl PyCatalogClientInternal {
303303
Py::new(py, (table, entry))
304304
}
305305

306+
// ---
307+
308+
/// Perform global maintenance tasks on the server.
309+
fn do_global_maintenance(self_: Py<Self>, py: Python<'_>) -> PyResult<()> {
310+
let connection = self_.borrow_mut(py).connection.clone();
311+
312+
connection.do_global_maintenance(py)
313+
}
314+
315+
// ---
316+
306317
/// The DataFusion context (if available).
307318
pub fn ctx(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
308319
if let Some(datafusion_ctx) = &self.datafusion_ctx {

rerun_py/src/catalog/connection_handle.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,21 @@ impl ConnectionHandle {
329329
)
330330
}
331331

332+
#[tracing::instrument(level = "info", skip_all)]
333+
pub fn do_global_maintenance(&self, py: Python<'_>) -> PyResult<()> {
334+
wait_for_future(
335+
py,
336+
async {
337+
self.client()
338+
.await?
339+
.do_global_maintenance()
340+
.await
341+
.map_err(to_py_err)
342+
}
343+
.in_current_span(),
344+
)
345+
}
346+
332347
// TODO(ab): migrate this to the `ConnectionClient` API.
333348
#[tracing::instrument(level = "info", skip_all)]
334349
pub fn query_tasks(&self, py: Python<'_>, task_ids: &[TaskId]) -> PyResult<RecordBatch> {

0 commit comments

Comments
 (0)