Skip to content

Commit

Permalink
Improve compatibility and precision of date information in log filenames
Browse files Browse the repository at this point in the history
There a few reasons that the current log filenames may not be ideal:

1) They contain `:` which breaks in Windows and is shown as `/` in OSX GUI ([#144](#144))
2) They don't contain any more precision than seconds, so with many concurrent plots being created (or error situations), naming collisions can occur
3) They don't contain any timezone information which makes them not fully comprehensive

This potentially closes #144

Note: As discussed on chat with @altendky, we settled on `+HH_MM` / `-HH_MM` for the timezone part (`±[hh]:[mm]` with the same `:` -> `_` done for times).  it seems that `strftime` provides the offset as one component via `%z`, without the option to use a `HH:MM` format.  For now I have left it without a separator, but it would be trivial to insert a `_` if it is desired. Thoughts?
  • Loading branch information
BasilHorowt committed Apr 27, 2021
1 parent 8cb707d commit fa6657e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plotman/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import time
from datetime import datetime

import pendulum
import psutil

# Plotman libraries
Expand Down Expand Up @@ -101,7 +102,7 @@ def maybe_start_new_plot(dir_cfg, sched_cfg, plotting_cfg):
dstdir = max(dir2ph, key=dir2ph.get)

logfile = os.path.join(
dir_cfg.log, datetime.now().strftime('%Y-%m-%d-%H:%M:%S.log')
dir_cfg.log, pendulum.now().strftime('%Y-%m-%dT%H_%M_%S.%f%z.log')
)

plot_args = ['chia', 'plots', 'create',
Expand Down

0 comments on commit fa6657e

Please sign in to comment.