Skip to content

Commit 2571d56

Browse files
committed
Debug logs for atomic file modifications
1 parent 143548e commit 2571d56

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/qq_lib/batch/interface/_arfe.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
from qq_lib.core.config import CFG
1616
from qq_lib.core.error import QQError
17+
from qq_lib.core.logger import get_logger
18+
19+
logger = get_logger(__name__)
1720

1821

1922
class _AtomicRemoteFileEditor:
@@ -44,6 +47,9 @@ def modify(self, modify_fn: Callable[[str], str]) -> None:
4447
Raises:
4548
QQError: If the SSH connection, lock acquisition, or write-back fails.
4649
"""
50+
logger.debug(
51+
f"Atomically modifying remote file '{self._file}' on host '{self._host}'."
52+
)
4753
script = self._build_script()
4854
proc = self._start_ssh(script)
4955

src/qq_lib/batch/pbs/pbs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,7 @@ def _modify_local_file_with_lock(
11231123
timeout = CFG.timeouts.flock
11241124
deadline = time.monotonic() + timeout
11251125

1126+
logger.debug(f"Atomically modifying local file '{file}'.")
11261127
with lockfile.open("w") as fd:
11271128
while True:
11281129
try:
@@ -1131,7 +1132,7 @@ def _modify_local_file_with_lock(
11311132
except OSError:
11321133
if time.monotonic() >= deadline:
11331134
raise QQError(
1134-
f"Could not acquire lock on {file} within {timeout} seconds."
1135+
f"Could not acquire lock on '{file}' within {timeout} seconds."
11351136
)
11361137
time.sleep(0.1)
11371138

0 commit comments

Comments
 (0)