Skip to content

Commit ca87d0b

Browse files
author
Andrei Neagu
committed
using log context and rename
1 parent 29533e9 commit ca87d0b

File tree

1 file changed

+8
-11
lines changed
  • services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules

1 file changed

+8
-11
lines changed

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/nodeports.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,16 @@ def _is_zip_file(file_path: Path) -> bool:
251251
async def _move_file_to_input_port(
252252
final_path: Path, downloaded_file: Path, dest_folder: PrunableFolder
253253
) -> None:
254-
_logger.debug("moving %s", downloaded_file)
255-
final_path = final_path / downloaded_file.name
254+
with log_context(_logger, logging.DEBUG, f"moving {downloaded_file}"):
255+
final_path = final_path / downloaded_file.name
256+
# ensure parent exists
257+
final_path.parent.mkdir(exist_ok=True, parents=True)
256258

257-
# ensure parent exists
258-
final_path.parent.mkdir(exist_ok=True, parents=True)
259+
await _shutil_move(downloaded_file, final_path)
259260

260-
await _shutil_move(downloaded_file, final_path)
261-
262-
# NOTE: after the download the current value of the port
263-
# makes sure previously downloaded files are removed
264-
dest_folder.prune(exclude={final_path})
265-
266-
_logger.debug("file moved to %s", final_path)
261+
# NOTE: after the port content changes, make sure old files
262+
# which are no longer part of the port, are removed
263+
dest_folder.prune(exclude={final_path})
267264

268265

269266
async def _get_data_from_port(

0 commit comments

Comments
 (0)