diff options
author | 2017-04-10 13:37:39 -0800 | |
---|---|---|
committer | 2017-04-10 15:13:42 -0700 | |
commit | 7a2b8153a3eb8ca21224c84857fe054060256ef6 (patch) | |
tree | 7822302fb2c6e9a360b9cb9e83a148061a591f7c /tensorflow/core/util/events_writer.h | |
parent | 5720f05489b247b7503640d4d1f70a5f5766e887 (diff) |
Allows summary writer to take an optional suffix= argument, which
is appended to every summary file name.
Change: 152736272
Diffstat (limited to 'tensorflow/core/util/events_writer.h')
-rw-r--r-- | tensorflow/core/util/events_writer.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tensorflow/core/util/events_writer.h b/tensorflow/core/util/events_writer.h index 2604ebdda2..a1a8cf790d 100644 --- a/tensorflow/core/util/events_writer.h +++ b/tensorflow/core/util/events_writer.h @@ -35,10 +35,10 @@ class EventsWriter { #endif // Events files typically have a name of the form - // '/some/file/path/my.file.out.events.[timestamp].[hostname]' + // '/some/file/path/my.file.out.events.[timestamp].[hostname][suffix]' // To create and EventWriter, the user should provide file_prefix = // '/some/file/path/my.file' - // The EventsWriter will append '.out.events.[timestamp].[hostname]' + // The EventsWriter will append '.out.events.[timestamp].[hostname][suffix]' // to the ultimate filename once Init() is called. // Note that it is not recommended to simultaneously have two // EventWriters writing to the same file_prefix. @@ -51,10 +51,14 @@ class EventsWriter { // and is open this is a no-op. If on the other hand the file was opened, // but has since disappeared (e.g. deleted by another process), this will open // a new file with a new timestamp in its filename. - bool Init(); + bool Init() { return InitWithSuffix(""); } + bool InitWithSuffix(const string& suffix) { + file_suffix_ = suffix; + return InitIfNeeded(); + } // Returns the filename for the current events file: - // filename_ = [file_prefix_].out.events.[timestamp].[hostname] + // filename_ = [file_prefix_].out.events.[timestamp].[hostname][suffix] string FileName(); // Append "event" to the file. The "tensorflow::" part is for swig happiness. @@ -78,9 +82,11 @@ class EventsWriter { private: bool FileHasDisappeared(); // True if event_file_path_ does not exist. + bool InitIfNeeded(); Env* env_; const string file_prefix_; + string file_suffix_; string filename_; std::unique_ptr<WritableFile> recordio_file_; std::unique_ptr<io::RecordWriter> recordio_writer_; |