Skip to content

Commit 16895e0

Browse files
authored
misc fixes (#280)
* guard None env Signed-off-by: Alexandros Koumparoulis <[email protected]> * add enable_goodbye_message flag Signed-off-by: Alexandros Koumparoulis <[email protected]> * write sbatch script if it does not exist Signed-off-by: Alexandros Koumparoulis <[email protected]> * Update slurm.py Signed-off-by: Alexandros Koumparoulis <[email protected]> * Update slurm.py Signed-off-by: Alexandros Koumparoulis <[email protected]> --------- Signed-off-by: Alexandros Koumparoulis <[email protected]> Signed-off-by: Alexandros Koumparoulis <[email protected]>
1 parent 0c49127 commit 16895e0

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

nemo_run/run/experiment.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def __init__(
302302
jobs: list[Job | JobGroup] | None = None,
303303
base_dir: str | None = None,
304304
clean_mode: bool = False,
305+
enable_goodbye_message: bool = True,
305306
) -> None:
306307
"""
307308
Initializes an experiment run by creating its metadata directory and saving the experiment config.
@@ -317,6 +318,7 @@ def __init__(
317318
_reconstruct: Generally, the user does not need to specify this flag.
318319
This is only set to True when using run.Experiment.from_dir.
319320
clean_mode: If True, disables all console output (logs, progress bars, etc.). Defaults to False.
321+
enable_goodbye_message: if True, prints goodbye message after submitting job. Defaults to True.
320322
"""
321323
configure_logging(level=log_level)
322324
self._reconstruct = _reconstruct
@@ -325,6 +327,7 @@ def __init__(
325327

326328
self._title = title
327329
self._id = id or f"{title}_{int(time.time())}"
330+
self._enable_goodbye_message = enable_goodbye_message
328331

329332
base_dir = str(base_dir or get_nemorun_home())
330333
self._exp_dir = os.path.join(base_dir, "experiments", title, self._id)
@@ -1181,16 +1184,17 @@ def __exit__(self, exc_type, exc_value, tb):
11811184
theme=os.environ.get("NEMO_RUN_CODE_THEME", "monokai"),
11821185
)
11831186
)
1184-
self.console.print(
1185-
Syntax(
1186-
self.GOODBYE_MESSAGE_BASH.format(
1187-
exp_id=self._id,
1188-
tasks=list(map(lambda job: job.id, self.jobs)),
1189-
),
1190-
"shell",
1191-
theme=os.environ.get("NEMO_RUN_CODE_THEME", "monokai"),
1187+
if self._enable_goodbye_message:
1188+
self.console.print(
1189+
Syntax(
1190+
self.GOODBYE_MESSAGE_BASH.format(
1191+
exp_id=self._id,
1192+
tasks=list(map(lambda job: job.id, self.jobs)),
1193+
),
1194+
"shell",
1195+
theme=os.environ.get("NEMO_RUN_CODE_THEME", "monokai"),
1196+
)
11921197
)
1193-
)
11941198

11951199
def _repr_svg_(self):
11961200
return self.to_config()._repr_svg_()

nemo_run/run/torchx_backend/packaging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def _get_details_from_script(fn_or_script: Script, serialize_configs: bool):
138138
fn_or_script, serialize_configs=True
139139
)
140140
metadata = fn_or_script.metadata
141-
env = env | fn_or_script.env
141+
if fn_or_script.env:
142+
env = env | fn_or_script.env
142143

143144
launcher = executor.get_launcher()
144145
if executor.supports_launcher_transform():

0 commit comments

Comments
 (0)