| 62 | } |
| 63 | |
| 64 | void PyRecordWriter::Flush(TF_Status* out_status) { |
| 65 | if (writer_ == nullptr) { |
| 66 | TF_SetStatus(out_status, TF_FAILED_PRECONDITION, |
| 67 | "Writer not initialized or previously closed"); |
| 68 | return; |
| 69 | } |
| 70 | Status s = writer_->Flush(); |
| 71 | if (s.ok()) { |
| 72 | // Per the RecordWriter contract, flushing the RecordWriter does not |
| 73 | // flush the underlying file. Here we need to do both. |
| 74 | s = file_->Flush(); |
| 75 | } |
| 76 | if (!s.ok()) { |
| 77 | Set_TF_Status_from_Status(out_status, s); |
| 78 | return; |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | void PyRecordWriter::Close(TF_Status* out_status) { |
| 83 | if (writer_ != nullptr) { |
no test coverage detected