From deefe8cafb146ea7a41e47b85afbdeb886088573 Mon Sep 17 00:00:00 2001 From: Andrew Audibert Date: Tue, 4 Aug 2020 18:17:40 -0700 Subject: [PATCH] [tf.data service] Only create journal writer when fault_tolerant_mode is enabled. PiperOrigin-RevId: 324931812 Change-Id: Ie0acbf5359d2db642118af886a3c754b3b07a6cd --- tensorflow/core/data/service/dispatcher_impl.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tensorflow/core/data/service/dispatcher_impl.cc b/tensorflow/core/data/service/dispatcher_impl.cc index ffeae96c117..9e705d51ea8 100644 --- a/tensorflow/core/data/service/dispatcher_impl.cc +++ b/tensorflow/core/data/service/dispatcher_impl.cc @@ -71,23 +71,21 @@ Status CreateWorkerStub(const std::string& address, const std::string& protocol, DataServiceDispatcherImpl::DataServiceDispatcherImpl( const experimental::DispatcherConfig& config) : config_(config) { - if (!config_.work_dir().empty()) { - journal_writer_ = absl::make_unique( - Env::Default(), JournalDir(config_.work_dir())); - } } Status DataServiceDispatcherImpl::Start() { + mutex_lock l(mu_); if (!config_.fault_tolerant_mode()) { LOG(INFO) << "Running with fault_tolerant_mode=False. The dispatcher will " "not be able to recover its state on restart."; return Status::OK(); } - mutex_lock l(mu_); if (config_.work_dir().empty()) { return errors::InvalidArgument( "fault_tolerant_mode is True, but no work_dir is configured."); } + journal_writer_ = absl::make_unique( + Env::Default(), JournalDir(config_.work_dir())); Update update; bool end_of_journal = false; FileJournalReader reader(Env::Default(), JournalDir(config_.work_dir()));