|
1 | 1 | import functools |
2 | 2 | import logging |
3 | | -import os |
4 | 3 | from collections.abc import AsyncGenerator |
5 | 4 | from contextlib import asynccontextmanager |
6 | | -from datetime import timedelta |
7 | 5 | from pathlib import Path |
8 | 6 | from typing import Final |
9 | 7 |
|
|
52 | 50 | from ..models.schemas.containers import ContainersCreate |
53 | 51 | from ..models.shared_store import SharedStore |
54 | 52 | from ..modules import nodeports, user_services_preferences |
55 | | -from ..modules.container_utils import run_command_in_container |
56 | 53 | from ..modules.mounted_fs import MountedVolumes |
57 | 54 | from ..modules.notifications._notifications_ports import PortNotifier |
58 | 55 | from ..modules.outputs import OutputsManager, event_propagation_disabled |
59 | | -from .long_running_tasks_utils import run_before_shutdown_actions |
| 56 | +from .long_running_tasks_utils import ( |
| 57 | + ensure_read_permissions_on_user_service_data, |
| 58 | + run_before_shutdown_actions, |
| 59 | +) |
60 | 60 | from .resource_tracking import send_service_started, send_service_stopped |
61 | 61 |
|
62 | 62 | _logger = logging.getLogger(__name__) |
|
67 | 67 | # NOTE: most services have only 1 "working" directory |
68 | 68 | CONCURRENCY_STATE_SAVE_RESTORE: Final[int] = 2 |
69 | 69 | _MINUTE: Final[int] = 60 |
70 | | -_TIMEOUT_PERMISSION_CHANGES: Final[timedelta] = timedelta(minutes=5) |
71 | 70 |
|
72 | 71 |
|
73 | 72 | def _raise_for_errors( |
@@ -317,18 +316,7 @@ async def _send_resource_tracking_stop(platform_status: SimcorePlatformStatus): |
317 | 316 | await _send_resource_tracking_stop(SimcorePlatformStatus.OK) |
318 | 317 | raise |
319 | 318 |
|
320 | | - # make sure sidecar has access to the files and that the user did not accidetally remove read access |
321 | | - # NOTE: command runs inside self container since the user service container might not always be running |
322 | | - self_container = os.environ["HOSTNAME"] |
323 | | - for path_to_store in ( # apply changes to otuputs and all state folders |
324 | | - *mounted_volumes.disk_state_paths_iter(), |
325 | | - mounted_volumes.disk_outputs_path, |
326 | | - ): |
327 | | - await run_command_in_container( |
328 | | - self_container, |
329 | | - command=f"chmod -R go+rX {path_to_store}", |
330 | | - timeout=_TIMEOUT_PERMISSION_CHANGES.total_seconds(), |
331 | | - ) |
| 319 | + await ensure_read_permissions_on_user_service_data(mounted_volumes) |
332 | 320 |
|
333 | 321 | await _send_resource_tracking_stop(SimcorePlatformStatus.OK) |
334 | 322 |
|
|
0 commit comments