Skip to content

Commit

Permalink
Add pre/post cmd to run_cmd
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Gitman <[email protected]>
  • Loading branch information
Kipok committed Dec 12, 2024
1 parent f5d11ad commit fa3f7a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nemo_skills/pipeline/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from nemo_skills.pipeline import add_task, check_if_mounted, get_cluster_config, run_exp
from nemo_skills.pipeline.app import app, typer_unpacker
from nemo_skills.pipeline.generate import wrap_cmd
from nemo_skills.utils import setup_logging

LOG = logging.getLogger(__file__)
Expand Down Expand Up @@ -50,6 +51,8 @@ def run_cmd(
run_after: List[str] = typer.Option(
None, help="Can specify a list of expnames that need to be completed before this one starts"
),
preprocess_cmd: str = typer.Option(None, help="Command to run before job"),
postprocess_cmd: str = typer.Option(None, help="Command to run after job"),
config_dir: str = typer.Option(None, help="Can customize where we search for cluster configs"),
log_dir: str = typer.Option(
None,
Expand All @@ -69,7 +72,7 @@ def run_cmd(
with run.Experiment(expname) as exp:
add_task(
exp,
cmd=get_cmd(extra_arguments=extra_arguments),
cmd=wrap_cmd(get_cmd(extra_arguments=extra_arguments), preprocess_cmd, postprocess_cmd),
task_name=expname,
log_dir=log_dir,
container=cluster_config["containers"][container],
Expand Down

0 comments on commit fa3f7a6

Please sign in to comment.