Skip to content

Commit

Permalink
Fix srun availability check (#15211)
Browse files Browse the repository at this point in the history
command -v

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
  • Loading branch information
awaelchli and justusschock committed Oct 20, 2022
1 parent bf45870 commit 0bafb38
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lightning_lite/plugins/environments/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def _validate_srun_used() -> None:
"""
if _IS_WINDOWS:
return
srun_exists = subprocess.call(["which", "srun"]) == 0
try:
srun_exists = subprocess.call(["command", "-v", "srun"]) == 0
except FileNotFoundError:
srun_exists = False
if srun_exists and not _is_srun_used():
hint = " ".join(["srun", os.path.basename(sys.executable), *sys.argv])[:64]
rank_zero_warn(
Expand Down

0 comments on commit 0bafb38

Please sign in to comment.