| 30 | } |
| 31 | |
| 32 | inline void commit_dataset(std::shared_ptr<deeplake_api::dataset> dataset, bool show_progress) |
| 33 | { |
| 34 | constexpr auto high_num_rows = 50000; |
| 35 | const bool print_progress = |
| 36 | (show_progress && dataset->num_rows() > high_num_rows && dataset->has_uncommitted_changes()); |
| 37 | auto promise = async::run_on_main([ds = std::move(dataset)]() { |
| 38 | return ds->commit(); |
| 39 | }); |
| 40 | if (print_progress) { |
| 41 | const std::string message = fmt::format("Committing dataset (samples: {})", dataset->num_rows()); |
| 42 | pg::utils::print_progress_and_wait(std::move(promise), message); |
| 43 | } else { |
| 44 | promise.get_future().get(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | } // namespace impl |
| 49 |
no test coverage detected