Skip to content

Commit 6d30aef

Browse files
jrbourbeauayushdg
andauthored
Raise informative error when on unsupported system (#1126)
* Raise informative error when on unsupported system Signed-off-by: James Bourbeau <[email protected]> * Retrigger CI Signed-off-by: James Bourbeau <[email protected]> --------- Signed-off-by: James Bourbeau <[email protected]> Co-authored-by: Ayush Dattagupta <[email protected]>
1 parent 84dead1 commit 6d30aef

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

nemo_curator/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import os
16+
import sys
1617

1718
from .package_info import (
1819
__contact_emails__,
@@ -35,3 +36,13 @@
3536
# We set these incase a user ever starts a ray cluster with nemo_curator, we need these for Xenna to work
3637
os.environ["RAY_MAX_LIMIT_FROM_API_SERVER"] = str(API_LIMIT)
3738
os.environ["RAY_MAX_LIMIT_FROM_DATA_SOURCE"] = str(API_LIMIT)
39+
40+
# Raise an informative error early to users on unsupported systems
41+
if sys.platform != "linux":
42+
_msg = (
43+
"NeMo-Curator currently only supports Linux systems, "
44+
f"while the current machine has a {sys.platform} system. \n"
45+
"For more information on installation and system requirements, see "
46+
"https://docs.nvidia.com/nemo/curator/latest/admin/installation.html"
47+
)
48+
raise ValueError(_msg)

tests/test___init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import sys
16+
17+
import pytest
18+
19+
20+
def test_raises_system_error(monkeypatch: pytest.MonkeyPatch):
21+
monkeypatch.setattr(sys, "modules", {})
22+
dummy_platform = "asdfasdf"
23+
monkeypatch.setattr(sys, "platform", dummy_platform)
24+
25+
with pytest.raises(ValueError, match="only supports Linux systems") as excinfo:
26+
import nemo_curator # noqa
27+
28+
assert dummy_platform in str(excinfo.value)

0 commit comments

Comments
 (0)