Skip to content

Commit

Permalink
Ignore errors when rotating logs on Windows. (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares committed Jul 22, 2020
1 parent 9fb64a0 commit f083d71
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions rqd/rqd/rqcore.py
Expand Up @@ -465,7 +465,13 @@ def run(self):
"%s.%s" % (runFrame.log_dir_file, rotateCount))
except Exception as e:
err = "Unable to rotate previous log file due to %s" % e
raise RuntimeError(err)
# Windows might fail while trying to rotate logs for checking if file is
# being used by another process. Frame execution doesn't need to
# be halted for this.
if platform.system() == "Windows":
log.warning(err)
else:
raise RuntimeError(err)
try:
self.rqlog = open(runFrame.log_dir_file, "w", 1)
self.waitForFile(runFrame.log_dir_file)
Expand Down Expand Up @@ -881,17 +887,17 @@ def rebootIdle(self):
def nimbyOn(self):
"""Activates nimby, does not kill any running frames until next nimby
event. Also does not unlock until sufficient idle time is reached."""
if os.getuid() != 0:
if platform.system() != "Windows" and os.getuid() != 0:
log.warning("Not starting nimby, not running as root")
return
if not self.nimby.active and platform.system() == "Linux":
if not self.nimby.active:
try:
self.nimby.run()
log.info("Nimby has been activated")
except:
self.nimby.locked = False
err = "Nimby is in the process of shutting down"
log.warning(err)
log.exception(err)
raise rqd.rqexceptions.RqdException(err)

def nimbyOff(self):
Expand Down

0 comments on commit f083d71

Please sign in to comment.