Skip to content

Commit 14f39c1

Browse files
committed
try
1 parent 47826e2 commit 14f39c1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pytorch_lightning/trainer/connectors/slurm_connector.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@ def resolve_root_node_address(self, root_node):
6666

6767
def register_slurm_signal_handlers(self):
6868
# see if we're using slurm (not interactive)
69-
job_name = os.environ.get('SLURM_JOB_NAME', '')
70-
on_slurm = job_name != 'bash'
69+
on_slurm = False
70+
try:
71+
job_name = os.environ['SLURM_JOB_NAME']
72+
if job_name != 'bash':
73+
on_slurm = True
74+
except Exception:
75+
pass
7176

7277
if on_slurm:
7378
log.info('Set SLURM handle signals.')

0 commit comments

Comments
 (0)