Skip to content

Commit f83bce0

Browse files
committed
Fix using the profile when some parts of the download fails
1 parent b0ba6f9 commit f83bce0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,21 @@ def libpythonvm_build_args():
275275
if not os.environ.get("GRAALPY_PGO_PROFILE") and mx.suite('graalpython-enterprise', fatalIfMissing=False):
276276
cmd = mx.command_function('python-get-latest-profile', fatalIfMissing=False)
277277
if cmd:
278+
profile = None
278279
try:
279280
profile = cmd([])
280281
except BaseException:
281-
mx.log(f"Not using any PGO profile")
282-
else:
282+
pass
283+
if profile and os.path.exists(profile):
283284
mx.log(f"Using PGO profile {profile}")
284285
build_args += [
285286
f"--pgo={profile}",
286287
"-H:+UnlockExperimentalVMOptions",
287288
"-H:+PGOPrintProfileQuality",
288289
"-H:-UnlockExperimentalVMOptions",
289290
]
291+
else:
292+
mx.log(f"Not using any PGO profile")
290293
return build_args
291294

292295

@@ -296,8 +299,6 @@ def graalpy_native_pgo_build_and_test(_):
296299
then builds a PGO-optimized GraalPy native standalone with the collected profile.
297300
The profile file will be named 'default.iprof' in native image build directory.
298301
"""
299-
import tempfile
300-
301302
with set_env(GRAALPY_PGO_PROFILE=""):
302303
mx.log(mx.colorize("[PGO] Building PGO-instrumented native image", color="yellow"))
303304
build_home = graalpy_standalone_home('native', enterprise=True, build=True)

0 commit comments

Comments
 (0)