Skip to content

Commit

Permalink
Rename group_uri to index_uri (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
jparismorgan authored Oct 15, 2024
1 parent 42b366b commit a5091c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apis/python/src/tiledb/vector_search/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,6 @@ def centralised_kmeans(
with tiledb.scope_ctx(ctx_or_config=config):
logger = setup(config, verbose)
group = tiledb.Group(index_group_uri)
centroids_uri = group[CENTROIDS_ARRAY_NAME].uri
if training_sample_size >= partitions:
if training_source_uri:
if training_source_type is None:
Expand Down Expand Up @@ -1261,6 +1260,7 @@ def centralised_kmeans(
# raise ValueError(f"We have a training_sample_size of {training_sample_size} but {partitions} partitions - training_sample_size must be >= partitions")
centroids = np.random.rand(dimensions, partitions)

centroids_uri = group[CENTROIDS_ARRAY_NAME].uri
logger.debug("Writing centroids to array %s", centroids_uri)
with tiledb.open(centroids_uri, mode="w", timestamp=index_timestamp) as A:
A[0:dimensions, 0:partitions] = centroids
Expand Down
36 changes: 18 additions & 18 deletions apis/python/src/tiledb/vector_search/type_erased_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,13 @@ void init_type_erased_module(py::module_& m) {
"__init__",
[](IndexVamana& instance,
const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
std::optional<TemporalPolicy> temporal_policy) {
new (&instance) IndexVamana(ctx, group_uri, temporal_policy);
new (&instance) IndexVamana(ctx, index_uri, temporal_policy);
},
py::keep_alive<1, 2>(), // IndexVamana should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("temporal_policy") = std::nullopt)
.def(
"__init__",
Expand Down Expand Up @@ -432,14 +432,14 @@ void init_type_erased_module(py::module_& m) {
"write_index",
[](IndexVamana& index,
const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
std::optional<TemporalPolicy> temporal_policy,
const std::string& storage_version) {
index.write_index(ctx, group_uri, temporal_policy, storage_version);
index.write_index(ctx, index_uri, temporal_policy, storage_version);
},
py::keep_alive<1, 2>(), // IndexVamana should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("temporal_policy") = std::nullopt,
py::arg("storage_version") = "")
.def("feature_type_string", &IndexVamana::feature_type_string)
Expand All @@ -450,34 +450,34 @@ void init_type_erased_module(py::module_& m) {
.def_static(
"clear_history",
[](const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
uint64_t timestamp) {
IndexVamana::clear_history(ctx, group_uri, timestamp);
IndexVamana::clear_history(ctx, index_uri, timestamp);
},
py::keep_alive<1, 2>(), // IndexVamana should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("timestamp"));

py::class_<IndexIVFPQ>(m, "IndexIVFPQ")
.def(
"__init__",
[](IndexIVFPQ& instance,
const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
IndexLoadStrategy index_load_strategy,
size_t memory_budget,
std::optional<TemporalPolicy> temporal_policy) {
new (&instance) IndexIVFPQ(
ctx,
group_uri,
index_uri,
index_load_strategy,
memory_budget,
temporal_policy);
},
py::keep_alive<1, 2>(), // IndexIVFPQ should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("index_load_strategy") = IndexLoadStrategy::PQ_INDEX,
py::arg("memory_budget") = 0,
py::arg("temporal_policy") = std::nullopt)
Expand Down Expand Up @@ -518,14 +518,14 @@ void init_type_erased_module(py::module_& m) {
"write_index",
[](IndexIVFPQ& index,
const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
std::optional<TemporalPolicy> temporal_policy,
const std::string& storage_version) {
index.write_index(ctx, group_uri, temporal_policy, storage_version);
index.write_index(ctx, index_uri, temporal_policy, storage_version);
},
py::keep_alive<1, 2>(), // IndexIVFPQ should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("temporal_policy") = std::nullopt,
py::arg("storage_version") = "")
.def("feature_type_string", &IndexIVFPQ::feature_type_string)
Expand All @@ -537,13 +537,13 @@ void init_type_erased_module(py::module_& m) {
.def_static(
"clear_history",
[](const tiledb::Context& ctx,
const std::string& group_uri,
const std::string& index_uri,
uint64_t timestamp) {
IndexIVFPQ::clear_history(ctx, group_uri, timestamp);
IndexIVFPQ::clear_history(ctx, index_uri, timestamp);
},
py::keep_alive<1, 2>(), // IndexIVFPQ should keep ctx alive.
py::arg("ctx"),
py::arg("group_uri"),
py::arg("index_uri"),
py::arg("timestamp"));

py::class_<IndexIVFFlat>(m, "IndexIVFFlat")
Expand Down

0 comments on commit a5091c7

Please sign in to comment.