message: Use strategy properties to check if a worker should checkpoint instead of use the TF_CONFIG. Using TF_CONFIG will cause errors if we use a cluster resolver to initialize the strategy.
diff: @@ -50,7 +50,6 @@ from __future__ import print_function
  import os
  from tensorflow.python.distribute import distribution_strategy_context
  -from tensorflow.python.distribute import multi_worker_util
  from tensorflow.python.lib.io import file_io
  @@ -80,7 +79,7 @@ def write_dirpath(dirpath, strategy=None):
  return dirpath
  if not strategy.extended._in_multi_worker_mode(): # pylint: disable=protected-access
  return dirpath
  - if multi_worker_util.is_chief():
  + if strategy.extended.should_checkpoint:
  return dirpath
  # If this worker is not chief and hence should not save file, save it to a
  # temporary directory to be removed later.
  @@ -96,8 +95,10 @@ def remove_temp_dirpath(dirpath, strategy=None):
  # If strategy is still not available, this is not in distributed training.
  # Fallback to no-op.
  return
  - if strategy.extended._in_multi_worker_mode(): # pylint: disable=protected-access
  - if not multi_worker_util.is_chief():
  + # TODO(anjalisridhar): Consider removing the check for multi worker mode since
  + # it is redundant when used with the should_checkpoint property.
  + if (strategy.extended._in_multi_worker_mode() and # pylint: disable=protected-access
  + not strategy.extended.should_checkpoint):
  # If this worker is not chief and hence should not save file, remove
  # the temporary directory.
  file_io.delete_recursively(_get_temp_dir(dirpath, strategy))
  