Skip to content

Commit

Permalink
[DOP-22266] - change celery queue name from queue.name to queue.slug
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-lixakov committed Dec 11, 2024
1 parent 7ce551e commit bafc6dc
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion syncmaster/backend/api/v1/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def start_run(
celery.send_task,
"run_transfer_task",
kwargs={"run_id": run.id},
queue=transfer.queue.name,
queue=transfer.queue.slug,
)
except KombuError as e:
async with unit_of_work:
Expand Down
2 changes: 1 addition & 1 deletion syncmaster/scheduler/transfer_job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def send_job_to_celery(transfer_id: int) -> None:
celery.send_task,
"run_transfer_task",
kwargs={"run_id": run.id},
queue=transfer.queue.name,
queue=transfer.queue.slug,
)
except KombuError as e:
async with unit_of_work:
Expand Down
1 change: 1 addition & 0 deletions tests/test_integration/test_run_transfer/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ async def queue(
session=session,
name=request.param,
group_id=group.id,
slug=request.param,
)
yield result
await session.delete(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async def group_transfer_integration_mock(
session=session,
name="test_queue",
group_id=group.id,
slug="test_queue",
)

members: list[MockUser] = []
Expand Down
4 changes: 2 additions & 2 deletions tests/test_unit/test_runs/test_create_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def test_developer_plus_can_create_run_of_transfer_his_group(
mock_send_task,
"run_transfer_task",
kwargs={"run_id": run.id},
queue=group_transfer.queue.name,
queue=group_transfer.queue.slug,
)


Expand Down Expand Up @@ -163,7 +163,7 @@ async def test_superuser_can_create_run(
mock_send_task,
"run_transfer_task",
kwargs={"run_id": run.id},
queue=group_transfer.queue.name,
queue=group_transfer.queue.slug,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def test_send_job_to_celery_with_success(
mock_send_task,
"run_transfer_task",
kwargs={"run_id": run.id},
queue=group_transfer.queue.name,
queue=group_transfer.queue.slug,
)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_unit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ async def create_queue(
session: AsyncSession,
name: str,
group_id: int,
slug: str | None = None,
description: str | None = None,
) -> Queue:
queue = Queue(
name=name,
description=description,
group_id=group_id,
slug=f"{group_id}-{name}",
slug=slug if slug is not None else f"{group_id}-{name}",
)
session.add(queue)
await session.commit()
Expand Down

0 comments on commit bafc6dc

Please sign in to comment.