Skip to content

Commit a3f5591

Browse files
GitHKAndrei Neagu
and
Andrei Neagu
authored
⚗️ Added debug only env var to sleep after removing user services ⚠️ (#6042)
Co-authored-by: Andrei Neagu <[email protected]>
1 parent 39a7cfc commit a3f5591

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

.env-devel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ COMPUTATIONAL_BACKEND_DEFAULT_FILE_LINK_TYPE=PRESIGNED
8282
COMPUTATIONAL_BACKEND_ON_DEMAND_CLUSTERS_FILE_LINK_TYPE=PRESIGNED
8383
DIRECTOR_V2_DEV_FEATURES_ENABLED=0
8484
DIRECTOR_V2_DYNAMIC_SCHEDULER_CLOSE_SERVICES_VIA_FRONTEND_WHEN_CREDITS_LIMIT_REACHED=1
85+
DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL=0
8586
DIRECTOR_V2_GENERIC_RESOURCE_PLACEMENT_CONSTRAINTS_SUBSTITUTIONS='{}'
8687
DIRECTOR_V2_HOST=director-v2
8788
DIRECTOR_V2_LOGLEVEL=WARNING

services/director-v2/src/simcore_service_director_v2/core/dynamic_services_settings/scheduler.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class DynamicServicesSchedulerSettings(BaseCustomSettings):
3030
)
3131

3232
DYNAMIC_SIDECAR_DOCKER_COMPOSE_VERSION: str = Field(
33-
"3.8", description="docker-compose spec version used in the compose-specs", deprecated=True
33+
"3.8",
34+
description="docker-compose spec version used in the compose-specs",
35+
deprecated=True,
3436
)
3537

3638
DYNAMIC_SIDECAR_ENABLE_VOLUME_LIMITS: bool = Field(
@@ -61,7 +63,9 @@ class DynamicServicesSchedulerSettings(BaseCustomSettings):
6163
description="Prometheus will scrape service placed on these networks",
6264
)
6365

64-
DIRECTOR_V2_DYNAMIC_SCHEDULER_CLOSE_SERVICES_VIA_FRONTEND_WHEN_CREDITS_LIMIT_REACHED: bool = Field(
66+
DIRECTOR_V2_DYNAMIC_SCHEDULER_CLOSE_SERVICES_VIA_FRONTEND_WHEN_CREDITS_LIMIT_REACHED: (
67+
bool
68+
) = Field(
6569
default=True,
6670
description=(
6771
"when the message indicating there are no more credits left in a wallet "
@@ -149,3 +153,11 @@ class DynamicServicesSchedulerSettings(BaseCustomSettings):
149153
"allow for some time to pass before declaring it failed."
150154
),
151155
)
156+
157+
#
158+
# DEBUG
159+
#
160+
161+
DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL: timedelta = Field(
162+
timedelta(0), description="time to sleep before removing a container"
163+
)

services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pylint: disable=relative-beyond-top-level
22

3+
import asyncio
34
import json
45
import logging
56
from typing import Any, cast
@@ -276,6 +277,11 @@ async def attempt_pod_removal_and_data_saving(
276277

277278
await service_remove_containers(app, scheduler_data.node_uuid, sidecars_client)
278279

280+
# used for debuug, normally sleeps 0
281+
await asyncio.sleep(
282+
settings.DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL.total_seconds()
283+
)
284+
279285
# only try to save the status if :
280286
# - it is requested to save the state
281287
# - the dynamic-sidecar has finished booting correctly

services/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ services:
281281
DIRECTOR_V2_PUBLIC_API_BASE_URL: ${DIRECTOR_V2_PUBLIC_API_BASE_URL}
282282
DIRECTOR_V2_SERVICES_CUSTOM_CONSTRAINTS: ${DIRECTOR_V2_SERVICES_CUSTOM_CONSTRAINTS}
283283
DIRECTOR_V2_PROFILING: ${DIRECTOR_V2_PROFILING}
284+
DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL: ${DIRECTOR_V2_DYNAMIC_SIDECAR_SLEEP_AFTER_CONTAINER_REMOVAL}
284285

285286
DYNAMIC_SIDECAR_ENDPOINT_SPECS_MODE_DNSRR_ENABLED: ${DYNAMIC_SIDECAR_ENDPOINT_SPECS_MODE_DNSRR_ENABLED}
286287
DYNAMIC_SIDECAR_ENABLE_VOLUME_LIMITS: ${DYNAMIC_SIDECAR_ENABLE_VOLUME_LIMITS}

0 commit comments

Comments
 (0)