[AZ-180] Enhance setup and improve inference logging

- Added a new Cython extension for the engine factory to the setup configuration.
- Updated the inference module to include additional logging for video batch processing and annotation callbacks.
- Refactored test cases to standardize the detection endpoint responses and include channel IDs in headers for better event handling.
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-03 05:58:55 +03:00
parent 8baa96978b
commit 834f846dc8
9 changed files with 64 additions and 38 deletions
+2 -2
View File
@@ -79,10 +79,10 @@ def test_auth_image_still_writes_once_before_detect(reset_main_inference):
r = client.post(
"/detect/image",
files={"file": ("p.jpg", img, "image/jpeg")},
headers={"Authorization": f"Bearer {token}"},
headers={"Authorization": f"Bearer {token}", "X-Channel-Id": "test-channel"},
)
# Assert
assert r.status_code == 200
assert r.status_code == 202
assert wb_hits.count(expected_path) == 1
with real_open(expected_path, "rb") as f:
assert f.read() == img
+6 -8
View File
@@ -342,14 +342,12 @@ class TestDetectVideoEndpoint:
content=video_body,
headers={
"X-Filename": "test.mp4",
"X-Channel-Id": "test-channel",
"Authorization": f"Bearer {token}",
},
)
# Assert
assert r.status_code == 200
data = r.json()
assert data["status"] == "started"
assert data["mediaId"] == content_hash
assert r.status_code == 202
stored = os.path.join(vd, f"{content_hash}.mp4")
assert os.path.isfile(stored)
with open(stored, "rb") as f:
@@ -372,11 +370,10 @@ class TestDetectVideoEndpoint:
r = client.post(
"/detect/video",
content=video_body,
headers={"X-Filename": "test.mp4"},
headers={"X-Filename": "test.mp4", "X-Channel-Id": "test-channel"},
)
# Assert
assert r.status_code == 200
assert r.json()["status"] == "started"
assert r.status_code == 202
def test_rejects_non_video_extension(self):
# Arrange
@@ -429,11 +426,12 @@ class TestDetectVideoEndpoint:
content=video_body,
headers={
"X-Filename": "v.mp4",
"X-Channel-Id": "test-channel",
"Authorization": f"Bearer {token}",
},
)
# Assert
assert r.status_code == 200
assert r.status_code == 202
all_received = b"".join(received_chunks)
assert all_received == video_body