Skip to content

Commit 2adb745

Browse files
authored
Merge pull request #477 from aperture-data/release-0.4.32
Release 0.4.32
2 parents ea4d8f0 + b185e0f commit 2adb745

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+475
-261
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The tests are inside the `test` dir.
3636
All the tests can be run with:
3737

3838
```bash
39+
export GCP_SERVICE_ACCOUNT_KEY=<content of a GCP SERVICE ACCOUNT JSON file>
3940
bash run_test.sh
4041
```
4142

aperturedb/BBoxDataCSV.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from matplotlib.transforms import Bbox
2-
from aperturedb import ParallelLoader
31
from aperturedb import CSVParser
42

53
HEADER_X_POS = "x_pos"

aperturedb/ConnectionDataCSV.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from aperturedb.CSVParser import CSVParser, CONSTRAINTS_PREFIX
3-
from aperturedb.Query import QueryBuilder, ObjectType
3+
from aperturedb.Query import QueryBuilder
44

55
logger = logging.getLogger(__name__)
66

aperturedb/Connector.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# THE SOFTWARE.
2626
#
2727
from __future__ import annotations
28+
from typing import Optional
2829
from . import queryMessage
2930
import sys
3031
import os
@@ -105,7 +106,7 @@ def __init__(self, host="localhost", port=55555,
105106
use_keepalive=True,
106107
retry_interval_seconds=1,
107108
retry_max_attempts=3,
108-
config: Configuration = None):
109+
config: Optional[Configuration] = None):
109110
"""
110111
Constructor for the Connector class.
111112
"""
@@ -167,11 +168,7 @@ def authenticate(self, shared_data, user, password, token):
167168
if not self.authenticated:
168169
if shared_data.session is None:
169170
self.shared_data.lock = Lock()
170-
try:
171-
self._authenticate(user, password, token)
172-
except Exception as e:
173-
raise UnauthenticatedException(
174-
"Authentication failed:", str(e))
171+
self._authenticate(user, password, token)
175172
else:
176173
self.shared_data = shared_data
177174
self.authenticated = True
@@ -277,7 +274,6 @@ def _refresh_token(self):
277274
raise UnauthorizedException(response)
278275

279276
def _connect(self):
280-
281277
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
282278
self.conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
283279
if self.use_keepalive:
@@ -327,10 +323,6 @@ def _connect(self):
327323
self.conn = self.context.wrap_socket(self.conn)
328324

329325
except BaseException as e:
330-
logger.error(
331-
f"Error connecting to server: {str(e)} {self.config}",
332-
exc_info=True,
333-
stack_info=True)
334326
self.conn.close()
335327
self.connected = False
336328
raise
@@ -347,7 +339,7 @@ def connect(self, details: str = None):
347339
self._connect()
348340
except socket.error as e:
349341
logger.error(
350-
f"Error connecting to server: {self.config} \r\n{details}.",
342+
f"Error connecting to server: {self.config} \r\n{details}. {e=}",
351343
exc_info=True,
352344
stack_info=True)
353345

@@ -436,8 +428,13 @@ def _query(self, query, blob_array = [], try_resume=True):
436428
if try_resume:
437429
self._renew_session()
438430
if tries == self.config.retry_max_attempts:
431+
# We have tried enough times, and failed. Log some state info.
439432
raise Exception(
440-
f"Could not query apertureDB using TCP.")
433+
f"Could not query apertureDB using TCP. \r\n\
434+
{self.connected=}\r\n \
435+
{self.authenticated=} \r\n \
436+
attempts={tries}/{self.config.retry_max_attempts} \r\n \
437+
{self.config=}")
441438
return (self.last_response, response_blob_array)
442439

443440
def query(self, q, blobs=[]):

aperturedb/ConnectorRest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
import json
3232
import logging
3333

34-
from threading import Lock
3534
from types import SimpleNamespace
36-
from dataclasses import dataclass
3735
from aperturedb.Connector import Connector
3836
from aperturedb.Configuration import Configuration
3937

aperturedb/DescriptorSetDataCSV.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ast
2-
from aperturedb import ParallelLoader
32
from aperturedb import CSVParser
43

54
HEADER_NAME = "name"

aperturedb/EntityDataCSV.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from aperturedb import CSVParser
2-
from aperturedb.EntityUpdateDataCSV import SingleEntityUpdateDataCSV
32
import logging
43

54
logger = logging.getLogger(__name__)

aperturedb/ImageDataCSV.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import time
2-
import requests
31
import boto3
42

5-
import numpy as np
63
import cv2
74

85
from aperturedb import CSVParser

aperturedb/ImageDownloader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import requests
33
import os
44
import logging
5-
from os import path
65

76
import cv2
87
import numpy as np

aperturedb/ParallelQuery.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import Callable, Dict, List, Tuple, Optional
2+
from typing import Callable, List, Tuple, Optional
33
from aperturedb import Parallelizer
44
import numpy as np
55
import json
@@ -147,8 +147,14 @@ def map_response_to_handler(cls, handler, query, query_blobs, response, respons
147147
blobs_returned += b_count
148148

149149
def __init__(self, db: Connector, dry_run: bool = False):
150-
151150
super().__init__()
151+
test_string = f"Connection test successful with {db.config}"
152+
try:
153+
_, _ = db.query([{"GetSchema": {}}], [])
154+
logger.info(test_string)
155+
except Exception as e:
156+
logger.error(test_string.replace("successful", "failed"))
157+
raise
152158

153159
self.db = db.create_new_connection()
154160

0 commit comments

Comments
 (0)