Skip to content

fix: Relative paths for ng_init_resources_server#937

Open
bogdansalyp wants to merge 8 commits intoNVIDIA-NeMo:mainfrom
bogdansalyp:bogdan/fix/relative_resources_servers
Open

fix: Relative paths for ng_init_resources_server#937
bogdansalyp wants to merge 8 commits intoNVIDIA-NeMo:mainfrom
bogdansalyp:bogdan/fix/relative_resources_servers

Conversation

@bogdansalyp
Copy link
Copy Markdown

@bogdansalyp bogdansalyp commented Mar 23, 2026

TL;DR

Allows users to use ng_init_resources_server from any location with any relative paths.

Tested scenarios

Tested on a file structure like:

nemo_gym_adapter/
├── 3rdparty
│   └── Gym
├── __init__.py
└── resources_servers
    ├── __init__.py
    └── my_weather_tool

1. Create a relative path resource server

cd 3rdparty/Gym
source .venv/bin/activate
ng_init_resources_server +entrypoint=../../resources_servers/hello_world

2. Create a resource server FROM a relative path

cd 3rdparty/Gym
source .venv/bin/activate
cd ../..
ng_init_resources_server +entrypoint=resources_servers/hello_world_2

Both commands:

  • Properly use templates from Gym directory
  • Create a correct requirements.txt with a correct path to Gym package

closes #936

Signed-off-by: Bogdan Salyp <bogdansalyp@gmail.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Mar 23, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@bogdansalyp bogdansalyp marked this pull request as draft March 23, 2026 23:17
Signed-off-by: Bogdan Salyp <bogdansalyp@gmail.com>
@bogdansalyp bogdansalyp force-pushed the bogdan/fix/relative_resources_servers branch from 6ec436f to e2a4638 Compare March 24, 2026 00:40
Signed-off-by: Bogdan Salyp <bogdansalyp@gmail.com>
@bogdansalyp
Copy link
Copy Markdown
Author

bogdansalyp commented Mar 24, 2026

@bxyu-nvidia or maybe I can add .resolve() by default to all config paths not to make distinction between config_path and resolved_config_path

@cmunley1
Copy link
Copy Markdown
Contributor

cmunley1 commented Mar 24, 2026

hi @bogdansalyp thanks for the PR!

resources servers outside of the local Gym install should already be possible. see this #649

This will search . for env.yaml and server paths, and should solve other resolution issues.

i am not sure about ng_init_resources_server, will give this a test on my end.

also note that there seems to be a bug in the pypi build #935 that we are looking into. in the meantime, i think pip install the local clone should suffice

@bogdansalyp
Copy link
Copy Markdown
Author

@cmunley1 thanks, I'll check and return back soon

This reverts commit 87fc340.

Signed-off-by: Bogdan Salyp <bogdansalyp@gmail.com>
@bogdansalyp bogdansalyp force-pushed the bogdan/fix/relative_resources_servers branch from 37f71c1 to 2d41014 Compare March 25, 2026 01:01
@bogdansalyp
Copy link
Copy Markdown
Author

bogdansalyp commented Mar 25, 2026

@cmunley1 I've reverted ng_run changes so that this PR fixes only ng_init_resources_server paths
Description of this PR is also updated, please check it out
TL;DR allows users to create resource_server from and to any relative paths

@bogdansalyp bogdansalyp marked this pull request as ready for review March 25, 2026 19:45
@bogdansalyp
Copy link
Copy Markdown
Author

bogdansalyp commented Mar 25, 2026

Also I've checked ng_run and yes, it does pick up local env.yaml from cwd but no it still crashes - it looks for requirements.txt or pyproject.toml only in gym root, not cwd

I have a fix for that too but it's better to make it a separate PR when this one is merged

@cmunley1 cmunley1 requested a review from bxyu-nvidia March 26, 2026 04:28
@bogdansalyp
Copy link
Copy Markdown
Author

@bxyu-nvidia can you please review this PR?

@cmunley1
Copy link
Copy Markdown
Contributor

@bogdansalyp can you try this branch? I pulled in your changes. #972

@cwing-nvidia cwing-nvidia added the community-request Issue reported or requested by someone from the community label Apr 2, 2026
@cmunley1
Copy link
Copy Markdown
Contributor

@bogdansalyp we pulled some of these changes into the 0.2.1 release, thanks again for flagging this, could you please retry with nemo-gym==0.2.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request Issue reported or requested by someone from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ng_init_resources_server crashes when using relative paths or used outside Gym root

3 participants