Skip to content

Commit

Permalink
Moving where we create log dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
john-science committed Jul 2, 2024
1 parent b3a9992 commit 0a465cc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions armi/runLog.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ def log(self, msgType, msg, single=False, label=None, **kwargs):
In this situation, we do the mangling needed to get the log level to the correct number.
And we do some custom string manipulation so we can handle de-duplicating warnings.
"""
if not os.path.exists(LOG_DIR):
createLogDir(LOG_DIR)

# Determine the log level: users can optionally pass in custom strings ("debug")
msgLevel = msgType if isinstance(msgType, int) else self.logLevels[msgType][0]

Expand Down Expand Up @@ -347,14 +344,6 @@ def concatenateLogs(logDir=None):
stdoutFiles = sorted(glob(os.path.join(logDir, "*.stdout")))
if not len(stdoutFiles):
info("No log files found to concatenate.")

# If the log dir is empty, we can delete it.
try:
os.rmdir(logDir)
except: # noqa: bare-except
# low priority concern: it's an empty log dir.
pass

return

info("Concatenating {0} log files".format(len(stdoutFiles)))
Expand Down Expand Up @@ -726,6 +715,10 @@ def createLogDir(logDir: str = None) -> None:
time.sleep(secondsWait)


if not os.path.exists(LOG_DIR):
createLogDir(LOG_DIR)


def logFactory():
"""Create the default logging object."""
return _RunLog(int(context.MPI_RANK))
Expand Down

0 comments on commit 0a465cc

Please sign in to comment.