fix!: preserve job attempt lineage, retries, and lifecycle states

BREAKING CHANGE: JobDescription, JobEventsRequest, FunctionErrorsRequest, and FunctionErrors gain optional Rust metadata/cursor fields. Existing struct literals must initialize them; use None when unavailable.

Preserve typed attempt state, pinned retry lineage, result decoders and freshness fences, and retained diagnostic paging across SDKs. Keep Python job data access method-only.
This commit is contained in:
Jack Ye
2026-11-20 20:35:59 -08:00
committed by GitHub
parent bfb55c72e9
commit b44807e4db
35 changed files with 1822 additions and 55 deletions
+69 -2
View File
@@ -81,6 +81,43 @@ impl Job {
self.inner.id().map(str::to_string)
}
#[getter]
pub fn job_id(&self) -> Option<String> {
self.inner.job_id()
}
#[getter]
pub fn operation_id(&self) -> Option<String> {
self.inner.operation_id()
}
#[getter]
pub fn attempt(&self) -> Option<u32> {
self.inner.attempt()
}
#[getter]
pub fn retry_of(&self) -> Option<String> {
self.inner.retry_of()
}
#[getter]
pub fn lifecycle_state(&self) -> Option<String> {
self.inner
.lifecycle_state()
.map(|state| state.as_str().to_string())
}
#[getter]
pub fn source_table_version(&self) -> Option<u64> {
self.inner.source_table_version()
}
#[getter]
pub fn execution_epoch(&self) -> Option<i64> {
self.inner.execution_epoch()
}
#[getter]
pub fn job_type(&self) -> Option<String> {
self.inner.job_type()
@@ -132,6 +169,15 @@ impl Job {
})
}
pub fn retry(self_: PyRef<'_, Self>) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.inner.clone();
future_into_py(self_.py(), async move {
Ok(Job {
inner: Arc::new(inner.retry().await.infer_error()?),
})
})
}
pub fn refresh(self_: PyRef<'_, Self>) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.inner.clone();
future_into_py(self_.py(), async move {
@@ -171,14 +217,19 @@ impl Job {
future_into_py(self_.py(), async move { inner.stats().await.infer_error() })
}
#[pyo3(signature = (*, limit=None, filter=None))]
#[pyo3(signature = (*, limit=None, filter=None, page_token=None))]
pub fn events(
self_: PyRef<'_, Self>,
limit: Option<u32>,
filter: Option<String>,
page_token: Option<String>,
) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.inner.clone();
let request = JobEventsRequest { limit, filter };
let request = JobEventsRequest {
limit,
filter,
page_token,
};
future_into_py(self_.py(), async move {
let batches = inner.events(request).await.infer_error()?;
Python::attach(|py| {
@@ -301,6 +352,13 @@ impl JobFailureInfo {
#[derive(Clone)]
pub struct JobDescription {
job_id: String,
attempt_job_id: Option<String>,
operation_id: Option<String>,
attempt: Option<u32>,
retry_of: Option<String>,
lifecycle_state: Option<String>,
source_table_version: Option<u64>,
execution_epoch: Option<i64>,
job_type: String,
state: String,
creation_ms: i64,
@@ -363,6 +421,15 @@ impl From<lancedb::database::JobDescription> for JobDescription {
let progress_json = description.progress_snapshot().to_string();
Self {
job_id: description.job_id,
attempt_job_id: description.attempt_job_id,
operation_id: description.operation_id,
attempt: description.attempt,
retry_of: description.retry_of,
lifecycle_state: description
.lifecycle_state
.map(|state| state.as_str().to_string()),
source_table_version: description.source_table_version,
execution_epoch: description.execution_epoch,
job_type: description.job_type,
state: description.state,
creation_ms: description.creation_ms,
+5 -1
View File
@@ -1014,6 +1014,7 @@ pub struct FunctionErrors {
pub records: Vec<FunctionErrorRecord>,
pub fragments: Vec<FunctionErrorFragment>,
pub truncated: bool,
pub page_token: Option<String>,
}
#[pymethods]
@@ -1037,6 +1038,7 @@ impl From<lancedb::function::FunctionErrors> for FunctionErrors {
records: errors.records.into_iter().map(Into::into).collect(),
fragments: errors.fragments.into_iter().map(Into::into).collect(),
truncated: errors.truncated,
page_token: errors.page_token,
}
}
}
@@ -2914,13 +2916,14 @@ impl Table {
})
}
#[pyo3(signature = (job_id=None, column=None, limit=None, history=false))]
#[pyo3(signature = (job_id=None, column=None, limit=None, history=false, page_token=None))]
pub fn function_errors(
self_: PyRef<'_, Self>,
job_id: Option<String>,
column: Option<String>,
limit: Option<usize>,
history: bool,
page_token: Option<String>,
) -> PyResult<Bound<'_, PyAny>> {
let inner = self_.inner_ref()?.clone();
let request = lancedb::function::FunctionErrorsRequest {
@@ -2928,6 +2931,7 @@ impl Table {
column,
limit,
history,
page_token,
};
future_into_py(self_.py(), async move {
let errors = inner.function_errors(request).await.infer_error()?;