Skip to content

Commit 10e9b7f

Browse files
review @pcrespov
1 parent 70020a4 commit 10e9b7f

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
from models_library.projects_access import Owner
1212
from models_library.projects_state import ProjectLocked, ProjectStatus
1313
from redis.asyncio.lock import Lock
14-
from servicelib.background_task import periodic_task
15-
from servicelib.logging_utils import log_context
14+
15+
from .background_task import periodic_task
16+
from .logging_utils import log_context
1617

1718
_logger = logging.getLogger(__name__)
1819

services/efs-guardian/src/simcore_service_efs_guardian/services/efs_manager.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ async def list_projects_across_whole_efs(self) -> list[ProjectID]:
110110
_project_id = parse_obj_as(ProjectID, item)
111111
directories.append(_project_id)
112112
except ValueError:
113-
_logger.warning(
113+
_logger.error(
114114
"This is not a project ID. This should not happen! %s",
115115
_item_path,
116116
)
117117
else:
118-
_logger.warning(
118+
_logger.error(
119119
"This is not a directory. This should not happen! %s",
120120
_item_path,
121121
)
@@ -131,7 +131,16 @@ async def remove_project_efs_data(self, project_id: ProjectID) -> None:
131131

132132
if Path.exists(_dir_path):
133133
# Remove the directory and all its contents
134-
shutil.rmtree(_dir_path)
135-
_logger.info("%s has been deleted.", _dir_path)
134+
try:
135+
shutil.rmtree(_dir_path)
136+
_logger.info("%s has been deleted.", _dir_path)
137+
except FileNotFoundError as e:
138+
_logger.error("Directory %s does not exist.", _dir_path)
139+
except PermissionError as e:
140+
_logger.error("Permission denied when trying to delete %s.", _dir_path)
141+
except NotADirectoryError as e:
142+
_logger.error("%s is not a directory.", _dir_path)
143+
except OSError as e:
144+
_logger.error("Error: %s. Issue with path: %s", e, _dir_path)
136145
else:
137-
_logger.warning("%s does not exist.", _dir_path)
146+
_logger.error("%s does not exist.", _dir_path)

0 commit comments

Comments
 (0)