Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f678be1
Merge pull request #665 from aperture-data/release-0.4.58
luisremis Apr 23, 2026
b8a2939
fix: update pre-commit CI to use python 3.12 (#676)
ad-claw000 May 18, 2026
eaa69bf
test: add initial suite of tests for Images.py (#674)
ad-claw000 May 19, 2026
9e0361c
fix: Combined logger exception/warning (#684)
ad-claw000 May 19, 2026
6d41466
docs: fixup reference links (#685)
ad-claw000 May 19, 2026
8d4fc52
feat(connector): add boolean parameter to connect at construction (#681)
ad-claw000 May 19, 2026
92f1997
fix(loader): show throughput even when errors occur (#670)
ad-claw000 May 19, 2026
b5cc797
chore(ci): implement CI optimizations (#691)
ad-claw000 May 20, 2026
b352ebd
docs: bring back hierarchy in ParallelLoader docs (#706)
ad-claw000 May 20, 2026
69aaeb9
fix(docs): correct docstrings for find_similar in Descriptors (#678)
ad-claw000 May 20, 2026
131222b
fix: Update Sort on DW Sort class. (#686)
ad-claw000 May 20, 2026
a90eeee
fix(parallel): handle aborted batches in map_response_to_handler (#682)
ad-claw000 May 20, 2026
638934d
Add concurrency control to ci
luisremis May 20, 2026
8abab49
ci: speed up PR pipeline
luisremis May 20, 2026
8b66933
feat: Add ConnectionPool class (#666)
ad-claw000 May 20, 2026
6c574c4
Update robots.md
luisremis May 20, 2026
fad6807
ci: collapse matrix and enable BuildKit on develop and main workflows
luisremis May 20, 2026
83ad122
fix(utils): handle newer schema response format in summary (#667)
ad-claw000 May 20, 2026
2b1b065
Fix: Prevent rich from swallowing Configuration objects in CLI output…
ad-claw000 May 21, 2026
d59ee2d
ci: replace notebook-deps base in test image, pin CLIP, push image, p…
luisremis May 21, 2026
55489f1
docs: improve documentation and fix typos (#716)
ad-claw000 May 21, 2026
1cd2a8e
fix(utils): censor token information in error logs (#672)
ad-claw000 May 21, 2026
de009c7
feat(Sources): Fallback to anonymous client for s3 and gs on auth fai…
ad-claw000 May 21, 2026
3b9e3da
fix(loader): fix dry_run execution in dask workers (#724)
ad-claw000 May 21, 2026
09f188c
fix: Combine logger exception/warning messages (#721)
ad-claw000 May 21, 2026
3625e0d
Version bump: 0.4.58 to 0.4.59
github-actions[bot] May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: actions/setup-python@v3
with:
python-version: '3.10'
python-version: '3.12'

- uses: pre-commit/[email protected]

Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ on:
branches:
- develop

# Newer pushes to develop supersede older in-flight runs. The post-test
# publish job (build_and_deploy_docs) only matters for the latest commit, so
# cancelling stale runs avoids wasting an hour of CI for code that is already
# obsolete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-test:
strategy:
fail-fast: false
matrix:
protocol: [http, non_http]

runs-on:
- benchmark

Expand All @@ -34,11 +37,25 @@ jobs:

- name: Build and Run Tests
env:
TEST_PROTOCOL: ${{ matrix.protocol }}
# Run both protocols inside a single job. run_test_container.sh starts
# the http and non_http stacks in parallel, so wall-clock time is
# roughly max(http, non_http) instead of the previous matrix approach
# which duplicated every docker image build (notebook deps / notebook
# / tests / coverage) on a second runner.
TEST_PROTOCOL: both
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
RUNNER_NAME: ${{ runner.name }}_develop
# BuildKit + inline cache so subsequent runs actually reuse layers
# pulled via --cache-from in ci.sh.
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
ADB_REPO: aperturedata/aperturedb
ADB_TAG: dev
LENZ_REPO: aperturedata/lenz
LENZ_TAG: dev
run: RUN_TESTS=true ./ci.sh
shell: bash

Expand All @@ -65,6 +82,8 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUNNER_NAME: ${{ runner.name }}
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
ADB_REPO: aperturedata/aperturedb
ADB_TAG: dev
LENZ_REPO: aperturedata/lenz
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:
branches:
- main

# Main only publishes the latest commit; cancel any in-flight run when a newer
# push lands so we don't waste an hour racing against ourselves.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
protocol: [http, non_http]

runs-on:
- benchmark

Expand All @@ -34,11 +35,21 @@ jobs:

- name: Build and Run Tests
env:
TEST_PROTOCOL: ${{ matrix.protocol }}
# Single job runs both protocols in parallel via run_test_container.sh
# rather than spinning up two matrix runners that each rebuild every
# docker image.
TEST_PROTOCOL: both
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
RUNNER_NAME: ${{ runner.name }}_main
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
ADB_REPO: aperturedata/aperturedb
ADB_TAG: dev
LENZ_REPO: aperturedata/lenz
LENZ_TAG: dev
run: RUN_TESTS=true ./ci.sh
shell: bash

Expand All @@ -65,6 +76,8 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUNNER_NAME: ${{ runner.name }}
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
ADB_REPO: aperturedata/aperturedb
ADB_TAG: dev
LENZ_REPO: aperturedata/lenz
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ on:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
run_test:
strategy:
fail-fast: false
matrix:
protocol: [http, non_http]

runs-on:
- gcp

steps:

- name: Cleanup previous run
run: docker run --rm -v ${{ github.workspace }}:/workspace alpine sh -c "rm -rf /workspace/test/aperturedb/db*"
run: docker run --rm -v ${{ github.workspace }}:/workspace alpine sh -c "rm -rf /workspace/test/aperturedb/db* /workspace/test/aperturedb/logs*"
continue-on-error: true

- uses: actions/checkout@v3
Expand All @@ -38,14 +37,28 @@ jobs:

- name: Build and Run Tests
env:
TEST_PROTOCOL: ${{ matrix.protocol }}
# Run both protocols inside a single job. run_test_container.sh starts
# the http and non_http stacks in parallel and runs both test
# containers concurrently, so wall-clock time is roughly max(http,
# non_http) instead of the previous matrix approach which duplicated
# all docker image builds (notebook/tests/coverage/deps) per protocol.
TEST_PROTOCOL: both
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GCP_SERVICE_ACCOUNT_KEY: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
RUNNER_NAME: ${{ runner.name }}_${{ matrix.protocol }}
RUNNER_NAME: ${{ runner.name }}_pr
RUN_TESTS: true
NO_PUSH: true
# Skip building the notebook image and the coverage publishing image;
# neither is required to execute the test suite and on PRs they would
# be discarded (NO_PUSH=true). This removes a large chunk of the
# build time without dropping any test coverage.
BUILD_AUX_IMAGES: false
# Use BuildKit for faster builds and proper layer caching from the
# registry via --cache-from + BUILDKIT_INLINE_CACHE.
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
TARGET_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}
ADB_REPO: aperturedata/aperturedb
Expand Down
10 changes: 8 additions & 2 deletions aperturedb/Blobs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
**Module providing the Blobs entity wrapper.**

This module contains the `Blobs` class which acts as an object mapper representation of blobs in ApertureDB,
inheriting from `Entities`.
"""
from __future__ import annotations

from aperturedb.Entities import Entities
Expand All @@ -7,7 +13,7 @@ class Blobs(Entities):
"""
**The object mapper representation of blobs in ApertureDB.**

This class is a layer on top of the native query.
It facilitates interactions with blobs in the database in the pythonic way.
This class is a layer on top of the native JSON query (e.g., [FindBlob](/query_language/Reference/blob_commands/FindBlob)).
It facilitates interactions with blobs in the database in the Pythonic way.
"""
db_object = "_Blob"
24 changes: 18 additions & 6 deletions aperturedb/CSVWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def convert_entity_data(input, entity_class: str, unique_key: Optional[str] = No
df = pd.DataFrame(input)
df.insert(0, 'EntityClass', entity_class)
if unique_key:
assert unique_key in df.columns, f"unique_key {unique_key} not found in the input data"
assert unique_key in df.columns, (
f"unique_key {unique_key} not found in the input data"
)
df[f"constraint_{unique_key}"] = df[unique_key]
return df

Expand Down Expand Up @@ -66,7 +68,9 @@ def convert_image_data(input, source_column: str, source_type: Optional[str] = N
"""
df = pd.DataFrame(input)

assert source_column in df.columns, f"source_column {source_column} not found in the input data"
assert source_column in df.columns, (
f"source_column {source_column} not found in the input data"
)

if source_type is None:
source_type = source_column
Expand All @@ -82,7 +86,9 @@ def convert_image_data(input, source_column: str, source_type: Optional[str] = N
df.insert(0, source_type, df[source_column])

if unique_key is not None:
assert unique_key in df.columns, f"unique_key {unique_key} not found in the input data"
assert unique_key in df.columns, (
f"unique_key {unique_key} not found in the input data"
)
df[f"constraint_{unique_key}"] = df[unique_key]

if format is not None:
Expand Down Expand Up @@ -140,19 +146,25 @@ def convert_connection_data(input,

if source_column is None:
source_column = source_property
assert source_column in df.columns, f"source_column {source_column} not found in the input data"
assert source_column in df.columns, (
f"source_column {source_column} not found in the input data"
)

if destination_column is None:
destination_column = destination_property
assert destination_column in df.columns, f"destination_column {destination_column} not found in the input data"
assert destination_column in df.columns, (
f"destination_column {destination_column} not found in the input data"
)

df.insert(0, 'ConnectionClass', connection_class)
df.insert(1, f"{source_class}@{source_property}", df[source_column])
df.insert(2, f"{destination_class}@{destination_property}",
df[destination_column])

if unique_key:
assert unique_key in df.columns, f"unique_key {unique_key} not found in the input data"
assert unique_key in df.columns, (
f"unique_key {unique_key} not found in the input data"
)
df[f"constraint_{unique_key}"] = df[unique_key]

return df
Expand Down
38 changes: 26 additions & 12 deletions aperturedb/CommonLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from aperturedb.Connector import Connector
from aperturedb.ConnectorRest import ConnectorRest
from aperturedb.types import Blobs, CommandResponses, Commands
from aperturedb.LoggingUtils import censor_tokens

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -83,9 +84,15 @@ def _create_configuration_from_json(config: Union[Dict, str],
clean_config = {k: v for k, v in config.items() if k != "password"}

# These fields are required.
assert "host" in config, f"host is required in the configuration: {clean_config}"
assert "username" in config, f"username is required in the configuration: {clean_config}"
assert "password" in config, f"password is required in the configuration: {clean_config}"
assert "host" in config, (
f"host is required in the configuration: {clean_config}"
)
assert "username" in config, (
f"username is required in the configuration: {clean_config}"
)
assert "password" in config, (
f"password is required in the configuration: {clean_config}"
)

# These fields have no default in the Configuration class.
if 'port' not in config:
Expand All @@ -95,7 +102,9 @@ def _create_configuration_from_json(config: Union[Dict, str],
config["name"] = name # will overwrite the name in the config

if name_required:
assert "name" in config, f"name is required in the configuration: {clean_config}"
assert "name" in config, (
f"name is required in the configuration: {clean_config}"
)
elif 'name' not in config:
config["name"] = "from_json"

Expand Down Expand Up @@ -291,7 +300,9 @@ def execute_query(client: Connector, query: Commands,
result = 0
logger.debug(f"Query={query}")
r, b = client.query(query, blobs)
logger.debug(f"Response={r}")

if logger.isEnabledFor(logging.DEBUG):
logger.debug(f"Response={censor_tokens(r)}")

if client.last_query_ok():
if response_handler is not None:
Expand All @@ -305,7 +316,8 @@ def execute_query(client: Connector, query: Commands,
raise e
else:
# Transaction failed entirely.
logger.error(f"Failed query = {query} with response = {r}")
logger.error(
f"Failed query = {query} with response = {censor_tokens(r)}")
result = 1

statuses = {}
Expand All @@ -329,7 +341,7 @@ def execute_query(client: Connector, query: Commands,
warn_list.append(wr)
if len(warn_list) != 0:
logger.warning(
f"Partial errors:\r\n{json.dumps(query, default=str)}\r\n{json.dumps(warn_list, default=str)}")
f"Partial errors:\r\n{json.dumps(query, default=str)}\r\n{json.dumps(censor_tokens(warn_list), default=str)}")
result = 2

return result, r, b
Expand All @@ -340,14 +352,16 @@ def map_response_to_handler(handler, query, query_blobs, response, response_blo
# We could potentially always call this handler function
# and let the user deal with the error cases.
blobs_returned = 0
for i in range(math.ceil(len(query) / commands_per_query)):
is_list = isinstance(response, list)
limit = len(response) if is_list else len(query)
for i in range(math.ceil(limit / commands_per_query)):
start = i * commands_per_query
end = start + commands_per_query
end = min(start + commands_per_query, limit)
blobs_start = i * blobs_per_query
blobs_end = blobs_start + blobs_per_query

b_count = 0
if issubclass(type(response), list):
if is_list:
for req, resp in zip(query[start:end], response[start:end]):
for k in req:
blob_returning_commands = ["FindImage", "FindBlob", "FindVideo",
Expand All @@ -361,8 +375,8 @@ def map_response_to_handler(handler, query, query_blobs, response, response_blo
handler(
query[start:end],
query_blobs[blobs_start:blobs_end],
response[start:end] if issubclass(
type(response), list) else response,
response[start:end] if isinstance(
response, list) else response,
response_blobs[blobs_returned:blobs_returned + b_count] if
len(response_blobs) >= blobs_returned + b_count else None,
None if cmd_index_offset is None else cmd_index_offset + i)
Expand Down
2 changes: 1 addition & 1 deletion aperturedb/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def auth_mode(self) -> str:
def __repr__(self) -> str:
mode = "REST" if self.use_rest else "TCP"
auth_mode = self.auth_mode()
return f"[{self.host}:{self.port} as {self.username} using {mode} with SSL={self.__ssl_mode()} auth={auth_mode}]"
return f"<{self.host}:{self.port} as {self.username} using {mode} with SSL={self.__ssl_mode()} auth={auth_mode}>"

def deflate(self) -> list:
return self.create_aperturedb_key(self.host, self.port, self.token,
Expand Down
Loading
Loading