Skip to content

Commit 32182f8

Browse files
szymondudyczManul from Pathway
authored andcommitted
Documentation of enums defined in rust (#9491)
GitOrigin-RevId: 0c647224921cddae42404a6b12c6b556eb4c0970
1 parent 9bf51c3 commit 32182f8

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

python/pathway/persistence/__init__.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ class Config:
119119
parameter to pw.run in case persistence is enabled.
120120
121121
Args:
122-
backend: persistence backend configuration;
122+
backend: persistence backend configuration.
123123
snapshot_interval_ms: the desired duration between snapshot updates in \
124-
milliseconds;
124+
milliseconds.
125+
persistence_mode: sets the persistence mode. See :py:class:`pathway.PersistenceMode` for more details.
125126
"""
126127

127128
backend: Backend
@@ -154,31 +155,17 @@ def simple_config(
154155
the snapshot may fall behind, and the less computational resources are
155156
required.
156157
persistence_mode: Can be set to one of the following values.
157-
``api.PersistenceMode.PERSISTING``: the default value and means that all data
158+
``pw.PersistenceMode.PERSISTING``: the default value and means that all data
158159
will be persisted. When this parameter is specified, or when it is omitted,
159160
and the configuration is passed to ``pw.run``, no additional actions are
160161
required to persist the state of your program. Alternatively, you can use
161-
``api.PersistenceMode.UDF_CACHING`` meaning that only user-defined function (UDF)
162+
``pw.PersistenceMode.UDF_CACHING`` meaning that only user-defined function (UDF)
162163
calls will be cached. The cache stores the mapping from function input parameters to
163164
their results, so if a function is called again with the same inputs,
164165
the cached result is returned.
165166
166167
Returns:
167168
Persistence config.
168-
169-
Note:
170-
171-
``api.PersistenceMode.UDF_CACHING`` currently works either when the File System
172-
is used as the backend for persistent storage, or, if another backend is used, a
173-
temporary directory will be created for writing the cache. In the latter case,
174-
persistence guarantees are not provided.
175-
176-
By default, ``api.PersistenceMode.UDF_CACHING`` does not persist data from input
177-
sources. This means that if the program restarts, it will re-read all input streams
178-
from the beginning. However, this behavior can be overridden by assigning names
179-
to specific input sources. If an input connector has a name parameter, the input
180-
stream for this source will also be persisted. Upon restart, the program will
181-
resume reading from the point where it previously stopped.
182169
"""
183170

184171
warnings.warn(

src/python_api.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4480,6 +4480,24 @@ pub struct DataStorage {
44804480
iceberg_catalog: Option<IcebergCatalogSettings>,
44814481
}
44824482

4483+
/// Specifies the type of persistence used by Pathway.
4484+
///
4485+
/// Attributes:
4486+
/// PERSISTING: Persists all data and state necessary to fully restore the computation.
4487+
/// UDF_CACHING: Only the results of UDFs, for which `cache_strategy` is set, are persisted, however, the data
4488+
/// needs to be read again by the input connectors.
4489+
///
4490+
/// Note:
4491+
/// ``pw.PersistenceMode.UDF_CACHING`` currently works either when the File System
4492+
/// is used as the backend for persistent storage, or, if another backend is used, a
4493+
/// temporary directory will be created for writing the cache. In the latter case,
4494+
/// persistence guarantees are not provided.
4495+
/// By default, ``pw.PersistenceMode.UDF_CACHING`` does not persist data from input
4496+
/// sources. This means that if the program restarts, it will re-read all input streams
4497+
/// from the beginning. However, this behavior can be overridden by assigning names
4498+
/// to specific input sources. If an input connector has a name parameter, the input
4499+
/// stream for this source will also be persisted. Upon restart, the program will
4500+
/// resume reading from the point where it previously stopped.
44834501
#[pyclass(module = "pathway.engine", frozen, name = "PersistenceMode")]
44844502
pub struct PyPersistenceMode(PersistenceMode);
44854503

src/python_api/external_index_wrappers.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ impl PyExternalIndexQuery {
161161
}
162162
}
163163

164+
/// Used for choosing the metric used in the USearchKnn index.
165+
/// As these correspond to values of `MetricKind` from the usearch crate,
166+
/// you can find more information about them in the
167+
/// `usearch documentation <https://docs.rs/usearch/latest/usearch/ffi/struct.MetricKind.html>`_.
168+
///
169+
/// Attributes:
170+
/// IP: Inner Product distance.
171+
/// L2SQ: Squared Euclidean distance.
172+
/// COS: Cosine distance.
173+
/// PEARSON: Pearson distance.
174+
/// HAVERSINE: Haversine distance.
175+
/// DIVERGENCE: Jensen Shannon Divergence distance.
176+
/// HAMMING: Hamming distance.
177+
/// TANIMOTO: Tanimoto distance.
178+
/// SORENSEN: Sorensen distance.
164179
#[pyclass(module = "pathway.engine", frozen, name = "USearchMetricKind")]
165180
pub struct PyUSearchMetricKind(USearchMetricKind);
166181

@@ -201,6 +216,11 @@ impl<'py> IntoPyObject<'py> for USearchMetricKind {
201216
}
202217
}
203218

219+
/// Used for choosing the metric used in the BruteForceKnn index.
220+
///
221+
/// Attributes:
222+
/// L2SQ: Squared Euclidean distance.
223+
/// COS: Cosine distance.
204224
#[pyclass(module = "pathway.engine", frozen, name = "BruteForceKnnMetricKind")]
205225
pub struct PyBruteForceKnnMetricKind(BruteForceKnnMetricKind);
206226

0 commit comments

Comments
 (0)