Skip to content

Commit

Permalink
fix(Monitoring): Argilla log middleware can be serialized using pickle
Browse files Browse the repository at this point in the history
Also, review and format the class name
  • Loading branch information
frascuchon committed Nov 15, 2022
1 parent 91a72c5 commit 16a12d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/argilla/monitoring/asgi.py
Expand Up @@ -101,7 +101,7 @@ async def cached_receive() -> Message:
return self._receive


class argillaLogHTTPMiddleware(BaseHTTPMiddleware):
class ArgillaLogHTTPMiddleware(BaseHTTPMiddleware):
"""An standard starlette middleware that enables argilla logs for http prediction requests"""

def __init__(
Expand All @@ -118,7 +118,9 @@ def __init__(
self._records_mapper = records_mapper or text_classification_mapper
self._queue = Queue()
self._worker_task = threading.Thread(
target=self.__worker__, name=argillaLogHTTPMiddleware.__name__, daemon=True
target=self.__worker__,
name=ArgillaLogHTTPMiddleware.__name__,
daemon=True,
)
self._worker_task.start()

Expand Down
6 changes: 3 additions & 3 deletions tests/client/test_asgi.py
Expand Up @@ -23,7 +23,7 @@

import argilla
from argilla.monitoring.asgi import (
argillaLogHTTPMiddleware,
ArgillaLogHTTPMiddleware,
token_classification_mapper,
)

Expand All @@ -35,7 +35,7 @@ def test_argilla_middleware_for_text_classification(monkeypatch):

app = FastAPI()
app.add_middleware(
argillaLogHTTPMiddleware,
ArgillaLogHTTPMiddleware,
api_endpoint=expected_endpoint,
dataset=expected_dataset_name,
)
Expand Down Expand Up @@ -92,7 +92,7 @@ def test_argilla_middleware_for_token_classification(monkeypatch):

app = Starlette()
app.add_middleware(
argillaLogHTTPMiddleware,
ArgillaLogHTTPMiddleware,
api_endpoint=expected_endpoint,
dataset=expected_dataset_name,
records_mapper=token_classification_mapper,
Expand Down

0 comments on commit 16a12d2

Please sign in to comment.