Skip to content

Commit c218bd1

Browse files
committed
Add unit tests to LeptonExecutor
Signed-Off-By: Robert Clark <roclark@nvidia.com>
1 parent 2071ad1 commit c218bd1

3 files changed

Lines changed: 604 additions & 2 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"editor.defaultFormatter": "charliermarsh.ruff",
77
"editor.codeActionsOnSave": {
88
"source.fixAll": "always",
9-
"source.organizeImports": "always"
9+
"source.organizeImports": "never"
1010
},
1111
"python.analysis.typeCheckingMode": "standard",
1212
"ruff.lint.args": [

nemo_run/core/execution/lepton.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,13 @@ def _node_group_id(self, client: APIClient) -> DedicatedNodeGroup:
133133
from the user with the list of node groups. Assumes there are no duplicate node groups.
134134
"""
135135
node_groups = client.nodegroup.list_all()
136+
if len(node_groups) < 1:
137+
raise RuntimeError("No node groups found in cluster. Ensure Lepton workspace has at least one node group.")
136138
node_group_map = {ng.metadata.name: ng for ng in node_groups}
137-
node_group_id = node_group_map[self.node_group]
139+
try:
140+
node_group_id = node_group_map[self.node_group]
141+
except KeyError:
142+
raise RuntimeError("Could not find node group that matches requested ID in the Lepton workspace. Ensure your requested node group exists.")
138143
return node_group_id
139144

140145
def _valid_node_ids(self, node_group_id: DedicatedNodeGroup, client: APIClient) -> Set:

0 commit comments

Comments
 (0)