Skip to content

Commit 4abd21a

Browse files
author
Andrei Neagu
committed
fixed test
1 parent c13ffb1 commit 4abd21a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

services/storage/src/simcore_service_storage/modules/celery/utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33

44
from .worker import CeleryWorkerClient
55

6-
_WORKER_KEY = "celery_worker_client"
6+
_WORKER_KEY = "celery_worker"
77
_FASTAPI_APP_KEY = "fastapi_app"
88

99

10+
def set_celery_worker_client(celery_app: Celery, worker: CeleryWorkerClient) -> None:
11+
celery_app.conf[_WORKER_KEY] = worker
12+
13+
1014
def get_celery_worker_client(celery_app: Celery) -> CeleryWorkerClient:
1115
worker = celery_app.conf[_WORKER_KEY]
1216
assert isinstance(worker, CeleryWorkerClient)
1317
return worker
1418

1519

20+
def set_fastapi_app(celery_app: Celery, fastapi_app: FastAPI) -> None:
21+
celery_app.conf[_FASTAPI_APP_KEY] = fastapi_app
22+
23+
1624
def get_fastapi_app(celery_app: Celery) -> FastAPI:
1725
fastapi_app = celery_app.conf[_FASTAPI_APP_KEY]
1826
assert isinstance(fastapi_app, FastAPI)
1927
return fastapi_app
20-
21-
22-
def set_celery_worker_client(celery_app: Celery, worker: CeleryWorkerClient) -> None:
23-
celery_app.conf[_WORKER_KEY] = worker
24-
25-
26-
def set_fastapi_app(celery_app: Celery, fastapi_app: FastAPI) -> None:
27-
celery_app.conf[_FASTAPI_APP_KEY] = fastapi_app

services/storage/tests/unit/modules/celery/test_celery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def sync_archive(task: Task, files: list[str]) -> str:
4848
assert task.name
4949
_logger.info("Calling async_archive")
5050
return asyncio.run_coroutine_threadsafe(
51-
_async_archive(task, task.request.id, files),
51+
_async_archive(task.app, task, files),
5252
get_event_loop(get_fastapi_app(task.app)),
5353
).result()
5454

0 commit comments

Comments
 (0)