Skip to content

Commit

Permalink
Empty tuple as default arg of clean_env
Browse files Browse the repository at this point in the history
  • Loading branch information
baldassarreFe authored Jul 29, 2024
1 parent b3a2ecd commit 597fe6a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions submitit/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@ def monitor_jobs(


@contextlib.contextmanager
def clean_env(extra_names: tp.Optional[tp.Sequence[str]] = None) -> tp.Iterator[None]:
def clean_env(extra_names: tp.Sequence[str] = ()) -> tp.Iterator[None]:
"""Removes slurm and submitit related environment variables so as to avoid interferences
when submiting a new job from a job.
Parameters
----------
extra_names: Sequence[str]
An optional list of environment variables to hide inside the context,
Additional environment variables to hide inside the context,
e.g. TRITON_CACHE_DIR and TORCHINDUCTOR_CACHE_DIR when using torch.compile.
Note
Expand All @@ -314,8 +314,6 @@ def clean_env(extra_names: tp.Optional[tp.Sequence[str]] = None) -> tp.Iterator[
with submitit.helpers.clean_env():
executor.submit(...)
"""
if extra_names is None:
extra_names = ()
distrib_names = ("MASTER_ADDR", "MASTER_PORT", "RANK", "WORLD_SIZE", "LOCAL_RANK", "LOCAL_WORLD_SIZE")
cluster_env = {
x: os.environ.pop(x)
Expand Down

0 comments on commit 597fe6a

Please sign in to comment.