From 1fe53d4abc865dede8a3810829157ee1a0b0302b Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 11:41:49 +0200 Subject: [PATCH 1/7] remove `\n` from reason --- .../src/servicelib/aiohttp/rest_responses.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/service-library/src/servicelib/aiohttp/rest_responses.py b/packages/service-library/src/servicelib/aiohttp/rest_responses.py index a1095b6004e7..8d36e9608844 100644 --- a/packages/service-library/src/servicelib/aiohttp/rest_responses.py +++ b/packages/service-library/src/servicelib/aiohttp/rest_responses.py @@ -8,10 +8,10 @@ from common_library.error_codes import ErrorCodeStr from common_library.json_serialization import json_dumps from models_library.rest_error import ErrorGet, ErrorItemType -from servicelib.rest_constants import RESPONSE_MODEL_POLICY from ..aiohttp.status import HTTP_200_OK from ..mimetype_constants import MIMETYPE_APPLICATION_JSON +from ..rest_constants import RESPONSE_MODEL_POLICY from ..rest_responses import is_enveloped from ..status_codes_utils import get_code_description @@ -54,7 +54,7 @@ def create_http_error( http_error_cls: type[HTTPError] = web.HTTPInternalServerError, *, skip_internal_error_details: bool = False, - error_code: ErrorCodeStr | None = None + error_code: ErrorCodeStr | None = None, ) -> HTTPError: """ - Response body conforms OAS schema model @@ -90,9 +90,8 @@ def create_http_error( payload = wrap_as_envelope( error=error.model_dump(mode="json", **RESPONSE_MODEL_POLICY) ) - return http_error_cls( - # Multiline not allowed in HTTP reason + # NOTE: reason cannot contain new lines reason=reason.replace("\n", " ") if reason else None, text=json_dumps( payload, From bf651e385876bc211ee0a4e3e25586f2c550d517 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 21:49:05 +0200 Subject: [PATCH 2/7] missing entries --- .../data/docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/clusters-keeper/src/simcore_service_clusters_keeper/data/docker-compose.yml b/services/clusters-keeper/src/simcore_service_clusters_keeper/data/docker-compose.yml index f0901f1093cd..6ba13f58eac9 100644 --- a/services/clusters-keeper/src/simcore_service_clusters_keeper/data/docker-compose.yml +++ b/services/clusters-keeper/src/simcore_service_clusters_keeper/data/docker-compose.yml @@ -3,6 +3,8 @@ services: image: ${DOCKER_REGISTRY:-itisfoundation}/dask-sidecar:${DOCKER_IMAGE_TAG} init: true hostname: "{{.Node.Hostname}}-{{.Task.Slot}}" + volumes: + - computational_shared_data:${SIDECAR_COMP_SERVICES_SHARED_FOLDER:-/home/scu/computational_shared_data} networks: - cluster environment: @@ -15,6 +17,9 @@ services: DASK_WORKER_SATURATION: ${DASK_WORKER_SATURATION} LOG_LEVEL: ${LOG_LEVEL} + SIDECAR_COMP_SERVICES_SHARED_FOLDER: /home/scu/computational_shared_data + SIDECAR_COMP_SERVICES_SHARED_VOLUME_NAME: computational_shared_data + ports: - 8786:8786 # dask-scheduler access - 8787:8787 # dashboard @@ -110,7 +115,7 @@ services: EC2_INSTANCES_TIME_BEFORE_DRAINING: ${WORKERS_EC2_INSTANCES_TIME_BEFORE_DRAINING} EC2_INSTANCES_TIME_BEFORE_TERMINATION: ${WORKERS_EC2_INSTANCES_TIME_BEFORE_TERMINATION} LOG_FORMAT_LOCAL_DEV_ENABLED: 1 - LOG_LEVEL: ${LOG_LEVEL:-WARNING} + LOG_LEVEL: ${LOG_LEVEL} REDIS_HOST: redis REDIS_PORT: 6379 volumes: From 15643d39acc25c97d59b7705ba34706382fe7db3 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 21:49:36 +0200 Subject: [PATCH 3/7] reduce noisy loggers --- .../core/application.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/services/clusters-keeper/src/simcore_service_clusters_keeper/core/application.py b/services/clusters-keeper/src/simcore_service_clusters_keeper/core/application.py index 120bfc873cba..ceb6413b00f0 100644 --- a/services/clusters-keeper/src/simcore_service_clusters_keeper/core/application.py +++ b/services/clusters-keeper/src/simcore_service_clusters_keeper/core/application.py @@ -23,11 +23,27 @@ from ..rpc.rpc_routes import setup_rpc_routes from .settings import ApplicationSettings -logger = logging.getLogger(__name__) +_LOG_LEVEL_STEP = logging.CRITICAL - logging.ERROR +_NOISY_LOGGERS = ( + "aiobotocore", + "aio_pika", + "aiormq", + "botocore", + "werkzeug", +) + +_logger = logging.getLogger(__name__) def create_app(settings: ApplicationSettings) -> FastAPI: - logger.info("app settings: %s", settings.model_dump_json(indent=1)) + # keep mostly quiet noisy loggers + quiet_level: int = max( + min(logging.root.level + _LOG_LEVEL_STEP, logging.CRITICAL), logging.WARNING + ) + for name in _NOISY_LOGGERS: + logging.getLogger(name).setLevel(quiet_level) + + _logger.info("app settings: %s", settings.model_dump_json(indent=1)) app = FastAPI( debug=settings.CLUSTERS_KEEPER_DEBUG, From 913a4493c1df597c22304fb1111d6ace4141c742 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 21:50:36 +0200 Subject: [PATCH 4/7] ruff --- .../src/simcore_service_clusters_keeper/utils/dask.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/clusters-keeper/src/simcore_service_clusters_keeper/utils/dask.py b/services/clusters-keeper/src/simcore_service_clusters_keeper/utils/dask.py index 6dc6a452fe42..6d32010cdd9f 100644 --- a/services/clusters-keeper/src/simcore_service_clusters_keeper/utils/dask.py +++ b/services/clusters-keeper/src/simcore_service_clusters_keeper/utils/dask.py @@ -7,10 +7,9 @@ def get_scheduler_url(ec2_instance: EC2InstanceData) -> AnyUrl: - url: AnyUrl = TypeAdapter(AnyUrl).validate_python( + return TypeAdapter(AnyUrl).validate_python( f"tls://{ec2_instance.aws_private_dns}:8786" ) - return url def get_scheduler_auth(app: FastAPI) -> ClusterAuthentication: From 15df8251b755eb817fff6c64c3709f26b693d202 Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 21:51:59 +0200 Subject: [PATCH 5/7] use pip as backup --- services/agent/docker/boot.sh | 8 ++++++-- services/api-server/docker/boot.sh | 8 ++++++-- services/autoscaling/docker/boot.sh | 8 ++++++-- services/catalog/docker/boot.sh | 8 ++++++-- services/clusters-keeper/docker/boot.sh | 8 ++++++-- services/dask-sidecar/docker/boot.sh | 6 +++++- services/datcore-adapter/docker/boot.sh | 8 ++++++-- services/director-v2/docker/boot.sh | 8 ++++++-- services/director/docker/boot.sh | 8 ++++++-- services/dynamic-scheduler/docker/boot.sh | 8 ++++++-- services/dynamic-sidecar/docker/boot.sh | 8 ++++++-- services/efs-guardian/docker/boot.sh | 8 ++++++-- services/invitations/docker/boot.sh | 8 ++++++-- services/notifications/docker/boot.sh | 8 ++++++-- services/payments/docker/boot.sh | 8 ++++++-- services/resource-usage-tracker/docker/boot.sh | 8 ++++++-- services/storage/docker/boot.sh | 8 ++++++-- services/web/server/docker/boot.sh | 8 ++++++-- 18 files changed, 107 insertions(+), 35 deletions(-) diff --git a/services/agent/docker/boot.sh b/services/agent/docker/boot.sh index 74c058e55ecc..5cc8f9f5aad6 100755 --- a/services/agent/docker/boot.sh +++ b/services/agent/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/agent/src/simcore_service_agent && \ - python -m debugpy --listen 0.0.0.0:${AGENT_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${AGENT_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --port 8000 \ --reload \ diff --git a/services/api-server/docker/boot.sh b/services/api-server/docker/boot.sh index 2f545af3a59c..ea12e3446c95 100755 --- a/services/api-server/docker/boot.sh +++ b/services/api-server/docker/boot.sh @@ -27,7 +27,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # RUNNING application ---------------------------------------- @@ -40,7 +44,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/api-server/src/simcore_service_api_server && \ - python -m debugpy --listen 0.0.0.0:${API_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${API_SERVER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/autoscaling/docker/boot.sh b/services/autoscaling/docker/boot.sh index a9adc4cda70c..c78cf322c2d1 100755 --- a/services/autoscaling/docker/boot.sh +++ b/services/autoscaling/docker/boot.sh @@ -31,7 +31,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -47,7 +51,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/autoscaling/src/simcore_service_autoscaling && \ - python -m debugpy --listen 0.0.0.0:${AUTOSCALING_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${AUTOSCALING_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/catalog/docker/boot.sh b/services/catalog/docker/boot.sh index ae506626b735..9db9967c98f9 100755 --- a/services/catalog/docker/boot.sh +++ b/services/catalog/docker/boot.sh @@ -27,7 +27,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # RUNNING application ---------------------------------------- @@ -40,7 +44,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/catalog/src/simcore_service_catalog && \ - python -m debugpy --listen 0.0.0.0:${CATALOG_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${CATALOG_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/clusters-keeper/docker/boot.sh b/services/clusters-keeper/docker/boot.sh index e25a2bb280ce..384133c7a874 100755 --- a/services/clusters-keeper/docker/boot.sh +++ b/services/clusters-keeper/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/clusters-keeper/src/simcore_service_clusters_keeper && \ - python -m debugpy --listen 0.0.0.0:${CLUSTERS_KEEPER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${CLUSTERS_KEEPER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/dask-sidecar/docker/boot.sh b/services/dask-sidecar/docker/boot.sh index e86c8518abc2..30cb7397189c 100755 --- a/services/dask-sidecar/docker/boot.sh +++ b/services/dask-sidecar/docker/boot.sh @@ -33,7 +33,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # RUNNING application ---------------------------------------- diff --git a/services/datcore-adapter/docker/boot.sh b/services/datcore-adapter/docker/boot.sh index 848a70e47330..187ea506ba8f 100755 --- a/services/datcore-adapter/docker/boot.sh +++ b/services/datcore-adapter/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # RUNNING application ---------------------------------------- @@ -45,7 +49,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/datcore-adapter/src/simcore_service_datcore_adapter && \ - python -m debugpy --listen 0.0.0.0:${DATCORE_ADAPTER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DATCORE_ADAPTER_REMOTE_DEBUG_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/director-v2/docker/boot.sh b/services/director-v2/docker/boot.sh index e8761c085a84..1af7ab240de5 100755 --- a/services/director-v2/docker/boot.sh +++ b/services/director-v2/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -47,7 +51,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/director-v2/src/simcore_service_director_v2 && \ - python -m debugpy --listen 0.0.0.0:${DIRECTOR_V2_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DIRECTOR_V2_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/director/docker/boot.sh b/services/director/docker/boot.sh index 35c79fc1a7aa..af732895050a 100755 --- a/services/director/docker/boot.sh +++ b/services/director/docker/boot.sh @@ -31,7 +31,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -47,7 +51,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/director/src/simcore_service_director && \ - python -m debugpy --listen 0.0.0.0:${DIRECTOR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DIRECTOR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/dynamic-scheduler/docker/boot.sh b/services/dynamic-scheduler/docker/boot.sh index c6c3cd4c849c..dae7ea09e1b2 100755 --- a/services/dynamic-scheduler/docker/boot.sh +++ b/services/dynamic-scheduler/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/dynamic-scheduler/src/simcore_service_dynamic_scheduler && \ - python -m debugpy --listen 0.0.0.0:${DYNAMIC_SCHEDULER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DYNAMIC_SCHEDULER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/dynamic-sidecar/docker/boot.sh b/services/dynamic-sidecar/docker/boot.sh index b68f0ae22baf..152fc8a04c04 100755 --- a/services/dynamic-sidecar/docker/boot.sh +++ b/services/dynamic-sidecar/docker/boot.sh @@ -33,7 +33,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -49,7 +53,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/dynamic-sidecar/src/simcore_service_dynamic_sidecar && \ - python -m debugpy --listen 0.0.0.0:${DYNAMIC_SIDECAR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${DYNAMIC_SIDECAR_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/efs-guardian/docker/boot.sh b/services/efs-guardian/docker/boot.sh index e2452e13a6e6..862a3456b266 100755 --- a/services/efs-guardian/docker/boot.sh +++ b/services/efs-guardian/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/efs-guardian/src/simcore_service_efs_guardian && \ - python -m debugpy --listen 0.0.0.0:${EFS_GUARDIAN_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${EFS_GUARDIAN_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/invitations/docker/boot.sh b/services/invitations/docker/boot.sh index cd8d839d0539..0616dc4c2b73 100755 --- a/services/invitations/docker/boot.sh +++ b/services/invitations/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/invitations/src/simcore_service_invitations && \ - python -m debugpy --listen 0.0.0.0:${INVITATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${INVITATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/notifications/docker/boot.sh b/services/notifications/docker/boot.sh index c967f242f7c3..8d079d9bc1be 100755 --- a/services/notifications/docker/boot.sh +++ b/services/notifications/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/notifications/src/simcore_service_notifications && \ - python -m debugpy --listen 0.0.0.0:${NOTIFICATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${NOTIFICATIONS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --port 8000 \ --reload \ diff --git a/services/payments/docker/boot.sh b/services/payments/docker/boot.sh index fa3024433dc7..1cc69d836653 100755 --- a/services/payments/docker/boot.sh +++ b/services/payments/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/payments/src/simcore_service_payments && \ - python -m debugpy --listen 0.0.0.0:${PAYMENTS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${PAYMENTS_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/resource-usage-tracker/docker/boot.sh b/services/resource-usage-tracker/docker/boot.sh index ddfbfaf306ea..fe90bb170508 100755 --- a/services/resource-usage-tracker/docker/boot.sh +++ b/services/resource-usage-tracker/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -48,7 +52,7 @@ if [ "${SC_BOOT_MODE}" = "debug" ]; then exec sh -c " cd services/resource-usage-tracker/src/simcore_service_resource_usage_tracker && \ - python -m debugpy --listen 0.0.0.0:${RESOURCE_USAGE_TRACKER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${RESOURCE_USAGE_TRACKER_REMOTE_DEBUGGING_PORT} -m uvicorn main:the_app \ --host 0.0.0.0 \ --reload \ $reload_dir_packages diff --git a/services/storage/docker/boot.sh b/services/storage/docker/boot.sh index 26c828eb807b..2b817f133214 100755 --- a/services/storage/docker/boot.sh +++ b/services/storage/docker/boot.sh @@ -32,7 +32,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi # @@ -70,7 +74,7 @@ else exec sh -c " cd services/storage/src/simcore_service_storage && \ - python -m debugpy --listen 0.0.0.0:${STORAGE_REMOTE_DEBUGGING_PORT} -m uvicorn main:app \ + python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:${STORAGE_REMOTE_DEBUGGING_PORT} -m uvicorn main:app \ --host 0.0.0.0 \ --port ${STORAGE_PORT} \ --reload \ diff --git a/services/web/server/docker/boot.sh b/services/web/server/docker/boot.sh index 3d2d7c40709e..add4415d44d0 100755 --- a/services/web/server/docker/boot.sh +++ b/services/web/server/docker/boot.sh @@ -31,7 +31,11 @@ fi if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: production does NOT pre-installs debugpy - uv pip install debugpy + if command -v uv >/dev/null 2>&1; then + uv pip install debugpy + else + pip install debugpy + fi fi APP_LOG_LEVEL=${WEBSERVER_LOGLEVEL:-${LOG_LEVEL:-${LOGLEVEL:-INFO}}} @@ -54,7 +58,7 @@ echo "$INFO" "GUNICORN_CMD_ARGS: $GUNICORN_CMD_ARGS" if [ "${SC_BOOT_MODE}" = "debug" ]; then # NOTE: ptvsd is programmatically enabled inside of the service # this way we can have reload in place as well - exec python -m debugpy --listen 0.0.0.0:"${WEBSERVER_REMOTE_DEBUGGING_PORT}" -m gunicorn simcore_service_webserver.cli:app_factory \ + exec python -Xfrozen_modules=off -m debugpy --listen 0.0.0.0:"${WEBSERVER_REMOTE_DEBUGGING_PORT}" -m gunicorn simcore_service_webserver.cli:app_factory \ --log-level="${SERVER_LOG_LEVEL}" \ --bind 0.0.0.0:8080 \ --worker-class aiohttp.GunicornUVLoopWebWorker \ From e1e3e42cd8d222a944f8f7bc5749e2503842d24b Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 22:03:03 +0200 Subject: [PATCH 6/7] revert --- .../src/servicelib/aiohttp/rest_responses.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/service-library/src/servicelib/aiohttp/rest_responses.py b/packages/service-library/src/servicelib/aiohttp/rest_responses.py index 8d36e9608844..a1095b6004e7 100644 --- a/packages/service-library/src/servicelib/aiohttp/rest_responses.py +++ b/packages/service-library/src/servicelib/aiohttp/rest_responses.py @@ -8,10 +8,10 @@ from common_library.error_codes import ErrorCodeStr from common_library.json_serialization import json_dumps from models_library.rest_error import ErrorGet, ErrorItemType +from servicelib.rest_constants import RESPONSE_MODEL_POLICY from ..aiohttp.status import HTTP_200_OK from ..mimetype_constants import MIMETYPE_APPLICATION_JSON -from ..rest_constants import RESPONSE_MODEL_POLICY from ..rest_responses import is_enveloped from ..status_codes_utils import get_code_description @@ -54,7 +54,7 @@ def create_http_error( http_error_cls: type[HTTPError] = web.HTTPInternalServerError, *, skip_internal_error_details: bool = False, - error_code: ErrorCodeStr | None = None, + error_code: ErrorCodeStr | None = None ) -> HTTPError: """ - Response body conforms OAS schema model @@ -90,8 +90,9 @@ def create_http_error( payload = wrap_as_envelope( error=error.model_dump(mode="json", **RESPONSE_MODEL_POLICY) ) + return http_error_cls( - # NOTE: reason cannot contain new lines + # Multiline not allowed in HTTP reason reason=reason.replace("\n", " ") if reason else None, text=json_dumps( payload, From ae1a1a9f59a931ac02036ad734fad6334c5b6add Mon Sep 17 00:00:00 2001 From: sanderegg <35365065+sanderegg@users.noreply.github.com> Date: Thu, 22 May 2025 22:05:28 +0200 Subject: [PATCH 7/7] ruff --- .../service-library/src/servicelib/aiohttp/rest_responses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/service-library/src/servicelib/aiohttp/rest_responses.py b/packages/service-library/src/servicelib/aiohttp/rest_responses.py index a1095b6004e7..68ce54bfc4b7 100644 --- a/packages/service-library/src/servicelib/aiohttp/rest_responses.py +++ b/packages/service-library/src/servicelib/aiohttp/rest_responses.py @@ -8,10 +8,10 @@ from common_library.error_codes import ErrorCodeStr from common_library.json_serialization import json_dumps from models_library.rest_error import ErrorGet, ErrorItemType -from servicelib.rest_constants import RESPONSE_MODEL_POLICY from ..aiohttp.status import HTTP_200_OK from ..mimetype_constants import MIMETYPE_APPLICATION_JSON +from ..rest_constants import RESPONSE_MODEL_POLICY from ..rest_responses import is_enveloped from ..status_codes_utils import get_code_description @@ -54,7 +54,7 @@ def create_http_error( http_error_cls: type[HTTPError] = web.HTTPInternalServerError, *, skip_internal_error_details: bool = False, - error_code: ErrorCodeStr | None = None + error_code: ErrorCodeStr | None = None, ) -> HTTPError: """ - Response body conforms OAS schema model