Skip to content

Commit 8c00993

Browse files
Merge branch 'master' into introduce-vip-models-pricing-2-part
2 parents fb06946 + 3642829 commit 8c00993

File tree

17 files changed

+179
-60
lines changed

17 files changed

+179
-60
lines changed

.env-devel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ DIRECTOR_V2_TRACING={}
126126
# DYNAMIC_SCHEDULER ----
127127
DYNAMIC_SCHEDULER_LOGLEVEL=DEBUG
128128
DYNAMIC_SCHEDULER_PROFILING=1
129+
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER=0
129130
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT=01:00:00
130131
DYNAMIC_SCHEDULER_TRACING={}
131132
DYNAMIC_SCHEDULER_UI_STORAGE_SECRET=adminadmin
@@ -211,7 +212,7 @@ RESOURCE_USAGE_TRACKER_S3=null
211212
RESOURCE_USAGE_TRACKER_TRACING={}
212213

213214
# NOTE: 172.17.0.1 is the docker0 interface, which redirect from inside a container onto the host network interface.
214-
R_CLONE_OPTION_BUFFER_SIZE=0M
215+
R_CLONE_OPTION_BUFFER_SIZE=16M
215216
R_CLONE_OPTION_RETRIES=3
216217
R_CLONE_OPTION_TRANSFERS=5
217218
R_CLONE_PROVIDER=MINIO

packages/service-library/src/servicelib/redis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from redis.backoff import ExponentialBackoff
1818
from settings_library.redis import RedisDatabase, RedisSettings
1919
from tenacity import retry
20+
from yarl import URL
2021

2122
from .background_task import periodic_task
2223
from .logging_utils import log_catch, log_context
@@ -94,7 +95,8 @@ def __post_init__(self):
9495
async def setup(self) -> None:
9596
if not await self.ping():
9697
await self.shutdown()
97-
raise CouldNotConnectToRedisError(dsn=self.redis_dsn)
98+
url_safe: URL = URL(self.redis_dsn).with_password("???")
99+
raise CouldNotConnectToRedisError(dsn=f"{url_safe}")
98100

99101
self._health_check_task = asyncio.create_task(
100102
self._check_health(),

packages/settings-library/src/settings_library/r_clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ class RCloneSettings(BaseCustomSettings):
2626
)
2727
# SEE https://rclone.org/docs/#buffer-size-size
2828
R_CLONE_OPTION_BUFFER_SIZE: str = Field(
29-
default="0M",
29+
default="16M",
3030
description="`--buffer-size X`: sets the amount of RAM to use for each individual transfer",
3131
)

packages/simcore-sdk/src/simcore_sdk/node_ports_common/r_clone.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
from pathlib import Path
99
from typing import Final
1010

11-
from common_library.errors_classes import OsparcErrorMixin
12-
1311
from aiocache import cached # type: ignore[import-untyped]
1412
from aiofiles import tempfile
13+
from common_library.errors_classes import OsparcErrorMixin
1514
from models_library.basic_types import IDStr
1615
from pydantic import AnyUrl, BaseModel, ByteSize
1716
from servicelib.progress_bar import ProgressBarData
@@ -207,7 +206,6 @@ async def _sync_sources(
207206
f"{r_clone_settings.R_CLONE_OPTION_TRANSFERS}",
208207
# below two options reduce to a minimum the memory footprint
209208
# https://forum.rclone.org/t/how-to-set-a-memory-limit/10230/4
210-
"--use-mmap", # docs https://rclone.org/docs/#use-mmap
211209
"--buffer-size", # docs https://rclone.org/docs/#buffer-size-size
212210
r_clone_settings.R_CLONE_OPTION_BUFFER_SIZE,
213211
"--use-json-log",

packages/simcore-sdk/src/simcore_sdk/node_ports_common/r_clone_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ class SyncProgressLogParser(BaseLogParser):
5252
5353
5454
This command:
55-
rclone --use-mmap --buffer-size 0M --transfers 5 sync mys3:simcore/5cfdef88-013b-11ef-910e-0242ac14003e/2d544003-9eb8-47e4-bcf7-95a8c31845f7/workspace ./tests3 --progress
55+
rclone --buffer-size 0M --transfers 5 sync mys3:simcore/5cfdef88-013b-11ef-910e-0242ac14003e/2d544003-9eb8-47e4-bcf7-95a8c31845f7/workspace ./tests3 --progress
5656
generates this but the rclone modifies the terminal printed lines which python does not like so much
5757
Transferred: 4.666 GiB / 4.666 GiB, 100%, 530.870 MiB/s, ETA 0s
5858
Transferred: 4 / 4, 100%
5959
Elapsed time: 9.6s
6060
6161
This other command:
62-
rclone --use-mmap --buffer-size 0M --transfers 5 --use-json-log --stats-log-level INFO -v --stats 500ms sync mys3:simcore/5cfdef88-013b-11ef-910e-0242ac14003e/2d544003-9eb8-47e4-bcf7-95a8c31845f7/workspace ./tests3
62+
rclone --buffer-size 0M --transfers 5 --use-json-log --stats-log-level INFO -v --stats 500ms sync mys3:simcore/5cfdef88-013b-11ef-910e-0242ac14003e/2d544003-9eb8-47e4-bcf7-95a8c31845f7/workspace ./tests3
6363
prints stuff such as:
6464
{"level":"info","msg":"Copied (new)","object":"README.ipynb","objectType":"*s3.Object","size":5123,"source":"operations/copy.go:360","time":"2024-04-23T14:05:10.408277+00:00"}
6565
{"level":"info","msg":"Copied (new)","object":".hidden_do_not_remove","objectType":"*s3.Object","size":219,"source":"operations/copy.go:360","time":"2024-04-23T14:05:10.408246+00:00"}

services/agent/src/simcore_service_agent/services/backup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ async def _store_in_s3(
161161
f"{settings.AGENT_VOLUMES_CLEANUP_PARALLELISM}",
162162
# below two options reduce to a minimum the memory footprint
163163
# https://forum.rclone.org/t/how-to-set-a-memory-limit/10230/4
164-
"--use-mmap", # docs https://rclone.org/docs/#use-mmap
165164
"--buffer-size", # docs https://rclone.org/docs/#buffer-size-size
166165
"0M",
167166
"--stats",

services/director-v2/.env-devel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ S3_BUCKET_NAME=simcore
6363
R_CLONE_PROVIDER=MINIO
6464
R_CLONE_OPTION_TRANSFERS=5
6565
R_CLONE_OPTION_RETRIES=3
66-
R_CLONE_OPTION_BUFFER_SIZE=0M
66+
R_CLONE_OPTION_BUFFER_SIZE=16M
6767

6868
TRACING_OBSERVABILITY_BACKEND_ENDPOINT=http://jaeger:9411
6969
TRAEFIK_SIMCORE_ZONE=internal_simcore_stack

services/director-v2/tests/unit/with_dbs/test_modules_dynamic_sidecar_docker_service_specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def expected_dynamic_sidecar_spec(
286286
"RABBIT_PORT": "5672",
287287
"RABBIT_USER": "admin",
288288
"RABBIT_SECURE": "False",
289-
"R_CLONE_OPTION_BUFFER_SIZE": "0M",
289+
"R_CLONE_OPTION_BUFFER_SIZE": "16M",
290290
"R_CLONE_OPTION_RETRIES": "3",
291291
"R_CLONE_OPTION_TRANSFERS": "5",
292292
"R_CLONE_PROVIDER": "MINIO",

services/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ services:
562562
REDIS_PASSWORD: ${REDIS_PASSWORD}
563563
DIRECTOR_V2_HOST: ${DIRECTOR_V2_HOST}
564564
DIRECTOR_V2_PORT: ${DIRECTOR_V2_PORT}
565+
DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER: ${DYNAMIC_SCHEDULER_USE_INTERNAL_SCHEDULER}
565566
DYNAMIC_SCHEDULER_LOGLEVEL: ${DYNAMIC_SCHEDULER_LOGLEVEL}
566567
DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT: ${DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT}
567568
DYNAMIC_SCHEDULER_PROFILING: ${DYNAMIC_SCHEDULER_PROFILING}

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/api/rpc/_services.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
ServiceWasNotFoundError,
1313
)
1414

15-
from ...core.settings import ApplicationSettings
16-
from ...services.director_v2 import DirectorV2Client
17-
from ...services.service_tracker import set_request_as_running, set_request_as_stopped
15+
from ...services import scheduler_interface
1816

1917
router = RPCRouter()
2018

@@ -23,23 +21,16 @@
2321
async def get_service_status(
2422
app: FastAPI, *, node_id: NodeID
2523
) -> NodeGet | DynamicServiceGet | NodeGetIdle:
26-
director_v2_client = DirectorV2Client.get_from_app_state(app)
27-
response: NodeGet | DynamicServiceGet | NodeGetIdle = (
28-
await director_v2_client.get_status(node_id)
29-
)
30-
return response
24+
return await scheduler_interface.get_service_status(app, node_id=node_id)
3125

3226

3327
@router.expose()
3428
async def run_dynamic_service(
3529
app: FastAPI, *, dynamic_service_start: DynamicServiceStart
3630
) -> NodeGet | DynamicServiceGet:
37-
director_v2_client = DirectorV2Client.get_from_app_state(app)
38-
response: NodeGet | DynamicServiceGet = (
39-
await director_v2_client.run_dynamic_service(dynamic_service_start)
31+
return await scheduler_interface.run_dynamic_service(
32+
app, dynamic_service_start=dynamic_service_start
4033
)
41-
await set_request_as_running(app, dynamic_service_start)
42-
return response
4334

4435

4536
@router.expose(
@@ -51,12 +42,6 @@ async def run_dynamic_service(
5142
async def stop_dynamic_service(
5243
app: FastAPI, *, dynamic_service_stop: DynamicServiceStop
5344
) -> None:
54-
director_v2_client = DirectorV2Client.get_from_app_state(app)
55-
settings: ApplicationSettings = app.state.settings
56-
await director_v2_client.stop_dynamic_service(
57-
node_id=dynamic_service_stop.node_id,
58-
simcore_user_agent=dynamic_service_stop.simcore_user_agent,
59-
save_state=dynamic_service_stop.save_state,
60-
timeout=settings.DYNAMIC_SCHEDULER_STOP_SERVICE_TIMEOUT,
45+
return await scheduler_interface.stop_dynamic_service(
46+
app, dynamic_service_stop=dynamic_service_stop
6147
)
62-
await set_request_as_stopped(app, dynamic_service_stop)

0 commit comments

Comments
 (0)