Skip to content

Added Pre-Launch Commands Support to LeptonExecutor#312

Merged
hemildesai merged 4 commits intoNVIDIA-NeMo:mainfrom
ansjindal:ansjindal/lepton-pre-launch-commands
Aug 6, 2025
Merged

Added Pre-Launch Commands Support to LeptonExecutor#312
hemildesai merged 4 commits intoNVIDIA-NeMo:mainfrom
ansjindal:ansjindal/lepton-pre-launch-commands

Conversation

@ansjindal
Copy link
Copy Markdown
Contributor

This PR adds support for custom pre-launch commands in the LeptonExecutor, allowing users to specify commands that run before the main job execution.

  • Added pre_launch_commands: list[str] field to LeptonExecutor dataclass

Example Usage

executor = run.LeptonExecutor(
    # ... other config ...
    pre_launch_commands=[
        "pip install custom-package",
        "export CUSTOM_VAR=value", 
        "mkdir -p /tmp/workspace"
    ]
)

The pre-launch commands are executed in sequence before the standard Lepton initialization, providing flexibility for custom job preparation while maintaining the existing workflow.

Signed-off-by: ansjindal <ansjindal@nvidia.com>
@hemildesai
Copy link
Copy Markdown
Contributor

Can you add tests for this change to make the CI pass?

@ansjindal
Copy link
Copy Markdown
Contributor Author

Yes, I will do it.

Signed-off-by: ansjindal <ansjindal@nvidia.com>
Signed-off-by: ansjindal <ansjindal@nvidia.com>
Signed-off-by: ansjindal <ansjindal@nvidia.com>
@hemildesai
Copy link
Copy Markdown
Contributor

LGTM, can merge after @roclark approves.

Copy link
Copy Markdown
Contributor

@roclark roclark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Anshul! Tested it out and works well for me.

@hemildesai hemildesai merged commit 6b34a8e into NVIDIA-NeMo:main Aug 6, 2025
19 of 21 checks passed
zoeyz101 pushed a commit to zoeyz101/NeMo-Run that referenced this pull request Nov 12, 2025
* update lepton executor to include custom prelaunch commands section

Signed-off-by: ansjindal <ansjindal@nvidia.com>

* add test for prelaunch section

Signed-off-by: ansjindal <ansjindal@nvidia.com>

* add more tests for checking the pre-launch-commands section

Signed-off-by: ansjindal <ansjindal@nvidia.com>

* update lepton executor tests

Signed-off-by: ansjindal <ansjindal@nvidia.com>

---------

Signed-off-by: ansjindal <ansjindal@nvidia.com>
Signed-off-by: Zoey Zhang <zozhang@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants