|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 | import asyncio |
4 | 4 | from datetime import datetime |
| 5 | +from typing import Annotated |
5 | 6 |
|
6 | 7 | from asgi_correlation_id import correlation_id |
7 | 8 | from fastapi import APIRouter, Depends, Query |
8 | 9 | from jinja2 import Template |
9 | 10 | from kombu.exceptions import KombuError |
10 | 11 |
|
| 12 | +from syncmaster.backend.dependencies import Stub |
11 | 13 | from syncmaster.backend.services import UnitOfWork, get_user |
| 14 | +from syncmaster.backend.settings import ServerAppSettings as Settings |
12 | 15 | from syncmaster.db.models import RunType, Status, User |
13 | 16 | from syncmaster.db.utils import Permission |
14 | 17 | from syncmaster.errors.registration import get_error_responses |
|
21 | 24 | ReadRunSchema, |
22 | 25 | RunPageSchema, |
23 | 26 | ) |
24 | | -from syncmaster.worker.config import celery |
25 | | -from syncmaster.worker.settings import get_worker_settings |
| 27 | +from syncmaster.worker import celery |
26 | 28 |
|
27 | 29 | router = APIRouter(tags=["Runs"], responses=get_error_responses()) |
28 | 30 |
|
@@ -81,6 +83,7 @@ async def read_run( |
81 | 83 | @router.post("/runs") |
82 | 84 | async def start_run( |
83 | 85 | create_run_data: CreateRunSchema, |
| 86 | + settings: Annotated[Settings, Depends(Stub(Settings))], |
84 | 87 | unit_of_work: UnitOfWork = Depends(UnitOfWork), |
85 | 88 | current_user: User = Depends(get_user(is_active=True)), |
86 | 89 | ) -> ReadRunSchema: |
@@ -117,7 +120,7 @@ async def start_run( |
117 | 120 | type=RunType.MANUAL, |
118 | 121 | ) |
119 | 122 |
|
120 | | - log_url = Template(get_worker_settings().worker.LOG_URL_TEMPLATE).render( |
| 123 | + log_url = Template(settings.server.log_url_template).render( |
121 | 124 | run=run, |
122 | 125 | correlation_id=correlation_id.get(), |
123 | 126 | ) |
|
0 commit comments