Skip to content

Commit

Permalink
fix: remove an offending chdir() statement
Browse files Browse the repository at this point in the history
  • Loading branch information
martynia committed Jul 26, 2023
1 parent 5079df4 commit 57ddc51
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/DIRAC/WorkloadManagementSystem/Agent/PilotLoggingAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ def clearOldPilotLogs(self, pilotLogPath):
files = os.listdir(pilotLogPath)
seconds = int(self.clearPilotsDelay) * 86400
currentTime = time.time()
os.chdir(pilotLogPath)

for file in files:
modifTime = os.stat(file).st_mtime
fullpath = os.path.join(pilotLogPath, file)
modifTime = os.stat(fullpath).st_mtime
if modifTime < currentTime - seconds:
self.log.debug(f" Deleting old log : {file}")
self.log.debug(f" Deleting old log : {fullpath}")
try:
os.remove(file)
os.remove(fullpath)
except Exception as excp:
self.log.exception(f"Cannot remove an old log file after {file}", lException=excp)
self.log.exception(f"Cannot remove an old log file after {fullpath}", lException=excp)

0 comments on commit 57ddc51

Please sign in to comment.