MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Flush

Method Flush

tensorflow/core/util/events_writer.cc:124–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124Status EventsWriter::Flush() {
125 if (num_outstanding_events_ == 0) return Status::OK();
126 CHECK(recordio_file_ != nullptr) << "Unexpected NULL file";
127
128 TF_RETURN_WITH_CONTEXT_IF_ERROR(recordio_writer_->Flush(), "Failed to flush ",
129 num_outstanding_events_, " events to ",
130 filename_);
131 TF_RETURN_WITH_CONTEXT_IF_ERROR(recordio_file_->Sync(), "Failed to sync ",
132 num_outstanding_events_, " events to ",
133 filename_);
134
135 // The FileStillExists() condition is necessary because
136 // recordio_writer_->Sync() can return OK even if the underlying
137 // file has been deleted. EventWriter.FileDeletionBeforeWriting
138 // demonstrates this and will fail if the FileHasDisappeared()
139 // condition is removed.
140 // Also, we deliberately attempt to Sync() before checking for a
141 // disappearing file, in case for some file system File::Exists() is
142 // false after File::Open() but before File::Sync().
143 TF_RETURN_WITH_CONTEXT_IF_ERROR(FileStillExists(), "Failed to flush ",
144 num_outstanding_events_, " events to ",
145 filename_);
146 VLOG(1) << "Wrote " << num_outstanding_events_ << " events to disk.";
147 num_outstanding_events_ = 0;
148 return Status::OK();
149}
150
151Status EventsWriter::Close() {
152 Status status = Flush();

Callers 6

testWriteEventsMethod · 0.95
TEST_FFunction · 0.45
TESTFunction · 0.45
InitializeMethod · 0.45
FlushAndCloseMethod · 0.45
TF_FlushWritableFileFunction · 0.45

Calls 1

SyncMethod · 0.45

Tested by 3

testWriteEventsMethod · 0.76
TEST_FFunction · 0.36
TESTFunction · 0.36