Skip to content

Commit

Permalink
webserver.py -> webserver_http.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Dec 12, 2024
1 parent deed91a commit 6d220d3
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastapi import APIRouter, Depends, status

from ...models.schemas.model_adapter import GetCreditPriceLegacy
from ..dependencies.webserver import AuthSession, get_webserver_session
from ..dependencies.webserver_http import AuthSession, get_webserver_session
from ._constants import FMSG_CHANGELOG_NEW_IN_VERSION

router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ..dependencies.application import get_reverse_url_mapper
from ..dependencies.authentication import get_current_user_id, get_product_name
from ..dependencies.services import get_api_client
from ..dependencies.webserver import AuthSession, get_webserver_session
from ..dependencies.webserver_http import AuthSession, get_webserver_session
from ._common import API_SERVER_DEV_FEATURES_ENABLED
from ._constants import FMSG_CHANGELOG_NEW_IN_VERSION

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from ..dependencies.application import get_reverse_url_mapper
from ..dependencies.authentication import get_current_user_id, get_product_name
from ..dependencies.services import get_api_client
from ..dependencies.webserver import AuthSession, get_webserver_session
from ..dependencies.webserver_http import AuthSession, get_webserver_session
from ._constants import (
FMSG_CHANGELOG_ADDED_IN_VERSION,
FMSG_CHANGELOG_CHANGED_IN_VERSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ...models.schemas.errors import ErrorGet
from ...models.schemas.studies import Study, StudyID, StudyPort
from ...services_http.webserver import AuthSession
from ..dependencies.webserver import get_webserver_session
from ..dependencies.webserver_http import get_webserver_session

_logger = logging.getLogger(__name__)
router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

from ...api.dependencies.authentication import get_current_user_id
from ...api.dependencies.services import get_api_client
from ...api.dependencies.webserver import get_webserver_session
from ...exceptions.backend_errors import ProjectAlreadyStartedError
from ...models.pagination import Page, PaginationParams
from ...models.schemas.errors import ErrorGet
Expand Down Expand Up @@ -48,6 +47,7 @@
)
from ...services_http.webserver import AuthSession
from ..dependencies.application import get_reverse_url_mapper
from ..dependencies.webserver_http import get_webserver_session
from ._common import API_SERVER_DEV_FEATURES_ENABLED
from ._constants import FMSG_CHANGELOG_CHANGED_IN_VERSION, FMSG_CHANGELOG_NEW_IN_VERSION
from .solvers_jobs import JOBS_STATUS_CODES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ...models.schemas.errors import ErrorGet
from ...models.schemas.profiles import Profile, ProfileUpdate
from ...services_http.webserver import AuthSession
from ..dependencies.webserver import get_webserver_session
from ..dependencies.webserver_http import get_webserver_session

_logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ...exceptions.service_errors_utils import DEFAULT_BACKEND_SERVICE_STATUS_CODES
from ...models.schemas.errors import ErrorGet
from ...models.schemas.model_adapter import WalletGetWithAvailableCreditsLegacy
from ..dependencies.webserver import AuthSession, get_webserver_session
from ..dependencies.webserver_http import AuthSession, get_webserver_session
from ._constants import FMSG_CHANGELOG_NEW_IN_VERSION

_logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
from servicelib.fastapi.profiler_middleware import ProfilerMiddleware
from servicelib.fastapi.tracing import setup_tracing
from servicelib.logging_utils import config_all_loggers
from simcore_service_api_server.api.dependencies.rabbitmq import get_rabbitmq_rpc_client

from .. import exceptions
from .._meta import API_VERSION, API_VTAG, APP_NAME
from ..api.root import create_router
from ..api.routes.health import router as health_router
from ..services_http import catalog, director_v2, storage, webserver
from ..services_http.rabbitmq import setup_rabbitmq
from ..services_rpc import wb_api_server
from ._prometheus_instrumentation import setup_prometheus_instrumentation
from .events import create_start_app_handler, create_stop_app_handler
from .openapi import override_openapi_method, use_route_names_as_operation_ids
Expand Down Expand Up @@ -92,6 +94,7 @@ def init_app(settings: ApplicationSettings | None = None) -> FastAPI:
settings.API_SERVER_WEBSERVER,
tracing_settings=settings.API_SERVER_TRACING,
)
wb_api_server.setup(app, get_rabbitmq_rpc_client(app))

if settings.API_SERVER_CATALOG:
catalog.setup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from ..api.dependencies.authentication import get_current_user_id
from ..api.dependencies.services import get_api_client
from ..api.dependencies.webserver import get_webserver_session
from ..api.dependencies.webserver_http import get_webserver_session
from ..models.schemas.jobs import (
JobID,
JobMetadata,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dataclasses import dataclass

from fastapi import FastAPI
from fastapi_pagination import Page, create_page
from servicelib.rabbitmq._client_rpc import RabbitMQRPCClient
from servicelib.rabbitmq.rpc_interfaces.webserver.licenses.licensed_items import (
Expand Down Expand Up @@ -31,3 +32,9 @@ async def get_licensed_items(
total=licensed_items_page.total,
params=page_params,
)


def setup(app: FastAPI, rabbitmq_rmp_client: RabbitMQRPCClient):
app.state.wb_api_rpc_client = WbApiRpcClient(
_rabbitmq_rpc_client=rabbitmq_rmp_client
)

0 comments on commit 6d220d3

Please sign in to comment.