From 670018758870af79d24951b074aa54eadbdd70c1 Mon Sep 17 00:00:00 2001 From: Md Fahim Faysal Khan Date: Mon, 23 Sep 2024 13:12:29 -0700 Subject: [PATCH] moved gsutil copy to condtional to avoid breakages --- MaxText/profiler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MaxText/profiler.py b/MaxText/profiler.py index e5df875dd..1477a69c0 100644 --- a/MaxText/profiler.py +++ b/MaxText/profiler.py @@ -18,6 +18,7 @@ from ctypes import cdll import os import subprocess +import shutil import max_logging @@ -61,6 +62,9 @@ def deactivate(self): max_logging.log("WARNING: library for nsys was not loaded \n" "profiler has no effect") return # Popen() instead of run() for non-blocking behavior - subprocess.Popen(["gsutil", "cp", "*nsys-rep", self.output_path]) # pylint: disable=consider-using-with + if shutil.which('gsutil') is not None: + subprocess.Popen(["gsutil", "cp", "*nsys-rep", self.output_path]) # pylint: disable=consider-using-with + else: + max_logging.log("WARNING: gsutil is not installed or not found in the system's PATH. Skipping upload...") elif self.mode == "xplane": jax.profiler.stop_trace()