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

Skip to content

Commit 5856878

Browse files
reedwmTaylor Robie
authored and
Taylor Robie
committed
Fix crash caused by race in the async process. (tensorflow#5250)
When constructing the evaluation records, data_async_generation.py would copy the records into the final directory. The main process would wait until the eval records existed. However, the main process would sometimes read the eval records before they were fully copied, causing a DataLossError.
1 parent dda23ec commit 5856878

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

official/recommendation/data_async_generation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,7 @@ def _construct_eval_record(cache_paths, eval_batch_size):
329329
items=items[i, :]
330330
)
331331
writer.write(batch_bytes)
332-
tf.gfile.Copy(intermediate_fpath, dest_fpath)
333-
tf.gfile.Remove(intermediate_fpath)
332+
tf.gfile.Rename(intermediate_fpath, dest_fpath)
334333
log_msg("Eval TFRecords file successfully constructed.")
335334

336335

0 commit comments

Comments
 (0)