Skip to content

Commit 1d9b237

Browse files
authored
Continuous indexing API update (#163)
Updates the continuous indexing endpoint to now support returning an AsyncJob for backfilling unindexed images in the dataset.
1 parent db8ecd0 commit 1d9b237

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

nucleus/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
ANNOTATIONS_PROCESSED_KEY = "annotations_processed"
44
ANNOTATION_ID_KEY = "annotation_id"
55
ANNOTATION_METADATA_SCHEMA_KEY = "annotation_metadata_schema"
6+
BACKFILL_JOB_KEY = "backfill_job"
67
BOX_TYPE = "box"
78
POLYGON_TYPE = "polygon"
89
MASK_TYPE = "mask"

nucleus/dataset.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333
from .constants import (
3434
ANNOTATIONS_KEY,
3535
AUTOTAG_SCORE_THRESHOLD,
36+
BACKFILL_JOB_KEY,
37+
DATASET_ID_KEY,
3638
DEFAULT_ANNOTATION_UPDATE_MODE,
3739
EXPORTED_ROWS,
3840
KEEP_HISTORY_KEY,
41+
MESSAGE_KEY,
3942
NAME_KEY,
4043
REFERENCE_IDS_KEY,
4144
REQUEST_ID_KEY,
@@ -769,9 +772,21 @@ def set_continuous_indexing(self, enable: bool = True):
769772
{
770773
"dataset_id": str,
771774
"message": str
775+
"backfill_job": AsyncJob,
772776
}
773777
"""
774-
return self._client.set_continuous_indexing(self.id, enable)
778+
preprocessed_response = self._client.set_continuous_indexing(
779+
self.id, enable
780+
)
781+
response = {
782+
DATASET_ID_KEY: preprocessed_response[DATASET_ID_KEY],
783+
MESSAGE_KEY: preprocessed_response[MESSAGE_KEY],
784+
}
785+
if enable:
786+
response[BACKFILL_JOB_KEY] = (
787+
AsyncJob.from_json(preprocessed_response, self._client),
788+
)
789+
return response
775790

776791
def create_image_index(self):
777792
"""Creates or updates image index by generating embeddings for images that do not already have embeddings.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = '''
2121

2222
[tool.poetry]
2323
name = "scale-nucleus"
24-
version = "0.3.1"
24+
version = "0.3.2"
2525
description = "The official Python client library for Nucleus, the Data Platform for AI"
2626
license = "MIT"
2727
authors = ["Scale AI Nucleus Team <nucleusapi@scaleapi.com>"]

0 commit comments

Comments
 (0)