From efbd42568ebaf3f72df176bb06d79a81b7bdcfdd Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 14 Mar 2025 12:12:19 -0700 Subject: [PATCH] Add retries to `tar` command in nccl `generated_srcs` target. PiperOrigin-RevId: 736944378 --- third_party/nccl/archive.BUILD | 3 ++- third_party/xla/third_party/nccl/archive.BUILD | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/third_party/nccl/archive.BUILD b/third_party/nccl/archive.BUILD index d726cea4db3..61d4975424e 100644 --- a/third_party/nccl/archive.BUILD +++ b/third_party/nccl/archive.BUILD @@ -93,7 +93,8 @@ genrule( cmd = """ mkdir -p src/device/generated $(location :generate) src/device/generated - tar --warning=no-file-changed -cf $@ src + # Retry the tar command three times to avoid flakiness. + (r=3;while ! tar --warning=no-file-changed -cf $@ src ; do ((--r))||exit;sleep 1;done) """, tools = [":generate"], ) diff --git a/third_party/xla/third_party/nccl/archive.BUILD b/third_party/xla/third_party/nccl/archive.BUILD index d726cea4db3..61d4975424e 100644 --- a/third_party/xla/third_party/nccl/archive.BUILD +++ b/third_party/xla/third_party/nccl/archive.BUILD @@ -93,7 +93,8 @@ genrule( cmd = """ mkdir -p src/device/generated $(location :generate) src/device/generated - tar --warning=no-file-changed -cf $@ src + # Retry the tar command three times to avoid flakiness. + (r=3;while ! tar --warning=no-file-changed -cf $@ src ; do ((--r))||exit;sleep 1;done) """, tools = [":generate"], )