xpk 1.0.0__py3-none-any.whl → 1.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. xpk/commands/cluster.py +29 -30
  2. xpk/commands/cluster_gcluster.py +19 -14
  3. xpk/commands/cluster_test.py +1 -21
  4. xpk/commands/common.py +39 -6
  5. xpk/commands/common_test.py +170 -0
  6. xpk/commands/info.py +9 -5
  7. xpk/commands/inspector.py +33 -4
  8. xpk/commands/inspector_test.py +142 -0
  9. xpk/commands/workload.py +35 -17
  10. xpk/commands/workload_test.py +70 -3
  11. xpk/core/blueprint/blueprint_generator.py +19 -8
  12. xpk/core/blueprint/testing/data/a3_ultra.yaml +3 -1
  13. xpk/core/blueprint/testing/data/a4.yaml +3 -1
  14. xpk/core/capacity.py +37 -17
  15. xpk/core/capacity_test.py +66 -1
  16. xpk/core/cluster.py +10 -10
  17. xpk/core/cluster_private.py +3 -3
  18. xpk/core/cluster_test.py +29 -2
  19. xpk/core/docker_container.py +55 -30
  20. xpk/core/docker_manager.py +4 -4
  21. xpk/core/docker_resources.py +4 -1
  22. xpk/core/kueue_manager.py +6 -8
  23. xpk/core/kueue_manager_test.py +4 -5
  24. xpk/core/nap.py +14 -3
  25. xpk/core/nodepool.py +46 -13
  26. xpk/core/nodepool_test.py +143 -8
  27. xpk/core/pathways.py +4 -8
  28. xpk/core/remote_state/fuse_remote_state.py +1 -1
  29. xpk/core/scheduling.py +16 -13
  30. xpk/core/scheduling_test.py +15 -7
  31. xpk/core/system_characteristics.py +6 -0
  32. xpk/core/telemetry.py +11 -1
  33. xpk/core/telemetry_test.py +39 -0
  34. xpk/core/testing/commands_tester.py +26 -0
  35. xpk/core/testing/commands_tester_test.py +20 -1
  36. xpk/core/workload_decorators/rdma_decorator.py +9 -0
  37. xpk/parser/cluster.py +11 -1
  38. xpk/parser/cluster_test.py +59 -1
  39. xpk/parser/common.py +11 -0
  40. xpk/parser/storage.py +3 -3
  41. xpk/utils/console.py +1 -1
  42. xpk/utils/feature_flags.py +7 -3
  43. {xpk-1.0.0.dist-info → xpk-1.1.1.dist-info}/METADATA +37 -21
  44. {xpk-1.0.0.dist-info → xpk-1.1.1.dist-info}/RECORD +48 -55
  45. xpk-1.1.1.dist-info/top_level.txt +1 -0
  46. integration/README.md +0 -19
  47. integration/__init__.py +0 -15
  48. integration/docker_manager_test.py +0 -102
  49. integration/gcluster_a3mega_test.py +0 -215
  50. integration/gcluster_a3ultra_test.py +0 -187
  51. integration/gcluster_a4_test.py +0 -187
  52. integration/gcluster_test.py +0 -107
  53. xpk/utils/user_input.py +0 -48
  54. xpk/utils/user_input_test.py +0 -92
  55. xpk-1.0.0.dist-info/top_level.txt +0 -2
  56. {xpk-1.0.0.dist-info → xpk-1.1.1.dist-info}/WHEEL +0 -0
  57. {xpk-1.0.0.dist-info → xpk-1.1.1.dist-info}/entry_points.txt +0 -0
  58. {xpk-1.0.0.dist-info → xpk-1.1.1.dist-info}/licenses/LICENSE +0 -0
xpk/utils/user_input.py DELETED
@@ -1,48 +0,0 @@
1
- """
2
- Copyright 2025 Google LLC
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- https://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- """
16
-
17
- from typing import Literal
18
-
19
- from .console import xpk_print
20
- from .execution_context import is_quiet
21
-
22
-
23
- def ask_for_user_consent(
24
- question: str, default_option: Literal["Y", "N"] = "N"
25
- ) -> bool:
26
- """Prompts user with the given question, asking for a yes/no answer and returns a relevant boolean.
27
- Important: immediatelly returns `True` in quiet mode!
28
-
29
- Example prompt for `question='Continue?'`: `[XPK] Continue? (y/N): `.
30
-
31
- Args:
32
- question: The question to ask the user.
33
- default_option: Option to use when user response is empty.
34
- """
35
- if is_quiet():
36
- return True
37
-
38
- options = "y/N" if default_option == "N" else "Y/n"
39
- prompt = f"[XPK] {question} ({options}): "
40
-
41
- while True:
42
- user_input = input(prompt) or default_option
43
- if user_input.lower() in ["yes", "y"]:
44
- return True
45
- elif user_input.lower() in ["no", "n"]:
46
- return False
47
- else:
48
- xpk_print("Invalid input. Please enter: yes/no/y/n.")
@@ -1,92 +0,0 @@
1
- """
2
- Copyright 2025 Google LLC
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- https://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- """
16
-
17
- from unittest.mock import MagicMock, patch
18
- import pytest
19
- from pytest_mock import MockerFixture
20
-
21
- from xpk.utils.user_input import ask_for_user_consent
22
-
23
-
24
- @pytest.fixture(autouse=True)
25
- def mock_is_quiet(mocker: MockerFixture):
26
- return mocker.patch("xpk.utils.user_input.is_quiet", return_value=False)
27
-
28
-
29
- @pytest.mark.parametrize(
30
- "user_input,expected",
31
- [
32
- ("yes", True),
33
- ("y", True),
34
- ("Y", True),
35
- ("Yes", True),
36
- ("YES", True),
37
- ("no", False),
38
- ("n", False),
39
- ("N", False),
40
- ("No", False),
41
- ("NO", False),
42
- ],
43
- )
44
- @patch("xpk.utils.user_input.input")
45
- def test_ask_for_user_consent(mock_input: MagicMock, user_input, expected):
46
- mock_input.return_value = user_input
47
-
48
- assert ask_for_user_consent("Test question?") is expected
49
-
50
-
51
- def fake_input_factory(user_inputs: list[str]):
52
- def fake_input(prompt: str) -> str:
53
- return user_inputs.pop(0)
54
-
55
- return fake_input
56
-
57
-
58
- @patch("xpk.utils.user_input.input", wraps=fake_input_factory(["invalid", "y"]))
59
- def test_ask_for_user_consent_invalid_input(mock_input: MagicMock):
60
- agreed = ask_for_user_consent("Test question?")
61
-
62
- assert agreed is True
63
- assert mock_input.call_count == 2
64
-
65
-
66
- @patch("xpk.utils.user_input.input", return_value="")
67
- def test_ask_for_user_consent_default_No(mock_input: MagicMock):
68
- agreed = ask_for_user_consent("Test question?", default_option="N")
69
-
70
- assert agreed is False
71
- mock_input.assert_called_once_with("[XPK] Test question? (y/N): ")
72
-
73
-
74
- @patch("xpk.utils.user_input.input", return_value="")
75
- def test_ask_for_user_consent_default_Yes(mock_input: MagicMock):
76
- agreed = ask_for_user_consent("Test question?", default_option="Y")
77
-
78
- assert agreed is True
79
- mock_input.assert_called_once_with("[XPK] Test question? (Y/n): ")
80
-
81
-
82
- @patch("xpk.utils.user_input.input")
83
- def test_ask_for_user_consent_with_quiet_mode_always_agrees(
84
- mock_input: MagicMock,
85
- mock_is_quiet: MagicMock,
86
- ):
87
- mock_is_quiet.return_value = True
88
-
89
- agreed = ask_for_user_consent("Test question?", default_option="N")
90
-
91
- assert agreed is True
92
- mock_input.assert_not_called()
@@ -1,2 +0,0 @@
1
- integration
2
- xpk
File without changes