Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bd3203

Browse files
committed
Rename flagfile so the next run at the same data_dir will still work.
1 parent 496878b commit 7bd3203

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

official/recommendation/data_async_generation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,20 @@ def _parse_flagfile():
460460
with tf.gfile.Open(flagfile, "r") as f:
461461
# This overrides FLAGS with flags from flagfile.
462462
flags.FLAGS([__file__] + f.read().splitlines())
463+
return flagfile
463464

464465

465466
def main(_):
466467
global _log_file
467-
_parse_flagfile()
468+
flagfile = _parse_flagfile()
468469

469470
redirect_logs = flags.FLAGS.redirect_logs
470471
cache_paths = rconst.Paths(
471472
data_dir=flags.FLAGS.data_dir, cache_id=flags.FLAGS.cache_id)
473+
# Rename flagfile so the next run at the same data_dir will still work.
474+
flagfile_with_id = flagfile + "_" + cache_paths.cache_id
475+
tf.gfile.Rename(flagfile, flagfile_with_id)
476+
tf.logging.info("Moving flagfile to {}.".format(flagfile_with_id))
472477

473478
log_file_name = "data_gen_proc_{}.log".format(cache_paths.cache_id)
474479
log_path = os.path.join(cache_paths.data_dir, log_file_name)

0 commit comments

Comments
 (0)