def testWorkerDoesRemoveFilePath(self): temp_dir = self.get_temp_dir() strategy = DistributedFileUtilsTest.MockedWorkerStrategy() dir_to_write = distributed_file_utils.write_dirpath(temp_dir, strategy) file_to_write = os.path.join(dir_to_write, 'tmp') self.assertFalse(os.path.exists(file_to_write)) self._write_dummy_file(file_to_write) self.assertTrue(os.path.exists(file_to_write)) distributed_file_utils.remove_temp_dir_with_filepath( file_to_write, strategy) self.assertFalse(os.path.exists(file_to_write))
def _maybe_remove_file(self): # Remove the checkpoint directory in multi-worker training where this worker # should not checkpoint. It is a dummy directory previously saved for sync # distributed training. distributed_file_utils.remove_temp_dir_with_filepath( self._write_filepath, self.model.distribute_strategy)
def _maybe_remove_file(self): distributed_file_utils.remove_temp_dir_with_filepath( self._write_filepath, self.model.distribute_strategy) if self.opt: distributed_file_utils.remove_temp_dir_with_filepath( self._write_filepath_opt, self.model.distribute_strategy)