hydra-submitit-launcher 1.4.0.dev5__tar.gz → 1.4.0.dev8__tar.gz
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.
- {hydra_submitit_launcher-1.4.0.dev5/hydra_submitit_launcher.egg-info → hydra_submitit_launcher-1.4.0.dev8}/PKG-INFO +2 -2
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_plugins/hydra_submitit_launcher/__init__.py +1 -1
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_plugins/hydra_submitit_launcher/config.py +3 -1
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_plugins/hydra_submitit_launcher/submitit_launcher.py +1 -1
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8/hydra_submitit_launcher.egg-info}/PKG-INFO +2 -2
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_submitit_launcher.egg-info/requires.txt +1 -1
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/setup.py +1 -1
- hydra_submitit_launcher-1.4.0.dev8/tests/test_submitit_launcher.py +140 -0
- hydra_submitit_launcher-1.4.0.dev5/tests/test_submitit_launcher.py +0 -65
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/MANIFEST.in +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/README.md +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_plugins/hydra_submitit_launcher/py.typed +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_submitit_launcher.egg-info/SOURCES.txt +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_submitit_launcher.egg-info/dependency_links.txt +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/hydra_submitit_launcher.egg-info/top_level.txt +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/pyproject.toml +0 -0
- {hydra_submitit_launcher-1.4.0.dev5 → hydra_submitit_launcher-1.4.0.dev8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hydra-submitit-launcher
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev8
|
|
4
4
|
Summary: Submitit Launcher for Hydra apps
|
|
5
5
|
Home-page: https://github.com/facebookincubator/submitit
|
|
6
6
|
Author: Jeremy Rapin, Jieru Hu, Omry Yadan
|
|
@@ -17,7 +17,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
Requires-Dist: hydra-core>=1.1.0.dev7
|
|
20
|
-
Requires-Dist: submitit>=1.
|
|
20
|
+
Requires-Dist: submitit>=1.4.6
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -18,7 +18,7 @@ class BaseQueueConf:
|
|
|
18
18
|
# number of gpus to use on each node
|
|
19
19
|
gpus_per_node: Optional[int] = None
|
|
20
20
|
# number of tasks to spawn on each node
|
|
21
|
-
tasks_per_node: int = 1
|
|
21
|
+
tasks_per_node: Optional[int] = 1
|
|
22
22
|
# memory to reserve for the job on each node (in GB)
|
|
23
23
|
mem_gb: Optional[int] = None
|
|
24
24
|
# number of nodes to use for the job
|
|
@@ -66,6 +66,8 @@ class SlurmQueueConf(BaseQueueConf):
|
|
|
66
66
|
# check the following for more info on slurm_max_num_timeout
|
|
67
67
|
# https://github.com/facebookincubator/submitit/blob/main/docs/checkpointing.md
|
|
68
68
|
max_num_timeout: int = 0
|
|
69
|
+
# Python executable to use instead of the default sys.executable
|
|
70
|
+
python: Optional[str] = None
|
|
69
71
|
# Useful to add parameters which are not currently available in the plugin.
|
|
70
72
|
# Eg: {"mail-user": "blublu@fb.com", "mail-type": "BEGIN"}
|
|
71
73
|
additional_parameters: Dict[str, Any] = field(default_factory=dict)
|
|
@@ -95,7 +95,7 @@ class BaseSubmititLauncher(Launcher):
|
|
|
95
95
|
params = self.params
|
|
96
96
|
# build executor
|
|
97
97
|
init_params = {"folder": self.params["submitit_folder"]}
|
|
98
|
-
specific_init_keys = {"max_num_timeout"}
|
|
98
|
+
specific_init_keys = {"max_num_timeout", "python"}
|
|
99
99
|
|
|
100
100
|
init_params.update(
|
|
101
101
|
**{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hydra-submitit-launcher
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev8
|
|
4
4
|
Summary: Submitit Launcher for Hydra apps
|
|
5
5
|
Home-page: https://github.com/facebookincubator/submitit
|
|
6
6
|
Author: Jeremy Rapin, Jieru Hu, Omry Yadan
|
|
@@ -17,7 +17,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
Requires-Dist: hydra-core>=1.1.0.dev7
|
|
20
|
-
Requires-Dist: submitit>=1.
|
|
20
|
+
Requires-Dist: submitit>=1.4.6
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
hydra-core>=1.1.0.dev7
|
|
2
|
-
submitit>=1.
|
|
2
|
+
submitit>=1.4.6
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional, Type
|
|
4
|
+
from unittest.mock import MagicMock, patch
|
|
5
|
+
|
|
6
|
+
import submitit
|
|
7
|
+
from hydra.core.plugins import Plugins
|
|
8
|
+
from hydra.plugins.launcher import Launcher
|
|
9
|
+
from hydra.test_utils.launcher_common_tests import (
|
|
10
|
+
IntegrationTestSuite,
|
|
11
|
+
LauncherTestSuite,
|
|
12
|
+
)
|
|
13
|
+
from hydra.test_utils.test_utils import chdir_plugin_root, run_python_script
|
|
14
|
+
from hydra.utils import instantiate
|
|
15
|
+
from omegaconf import OmegaConf
|
|
16
|
+
from pytest import mark
|
|
17
|
+
|
|
18
|
+
from hydra_plugins.hydra_submitit_launcher import submitit_launcher
|
|
19
|
+
from hydra_plugins.hydra_submitit_launcher.config import SlurmQueueConf
|
|
20
|
+
|
|
21
|
+
chdir_plugin_root()
|
|
22
|
+
|
|
23
|
+
pytestmark = mark.filterwarnings("ignore:pkg_resources is deprecated as an API:Warning")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@mark.parametrize(
|
|
27
|
+
"cls", [submitit_launcher.LocalLauncher, submitit_launcher.SlurmLauncher]
|
|
28
|
+
)
|
|
29
|
+
def test_discovery(cls: Type[Launcher]) -> None:
|
|
30
|
+
# Tests that this plugin can be discovered via the plugins subsystem when looking for Launchers
|
|
31
|
+
assert cls.__name__ in [x.__name__ for x in Plugins.instance().discover(Launcher)]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@mark.parametrize(
|
|
35
|
+
"launcher_name, overrides", [("submitit_local", ["hydra.launcher.timeout_min=2"])]
|
|
36
|
+
)
|
|
37
|
+
class TestSubmititLauncher(LauncherTestSuite):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@mark.parametrize(
|
|
42
|
+
"task_launcher_cfg, extra_flags",
|
|
43
|
+
[
|
|
44
|
+
(
|
|
45
|
+
{},
|
|
46
|
+
[
|
|
47
|
+
"-m",
|
|
48
|
+
"hydra/hydra_logging=disabled",
|
|
49
|
+
"hydra/job_logging=disabled",
|
|
50
|
+
"hydra/launcher=submitit_local",
|
|
51
|
+
"hydra.launcher.gpus_per_node=0",
|
|
52
|
+
"hydra.launcher.timeout_min=1",
|
|
53
|
+
],
|
|
54
|
+
),
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
class TestSubmititLauncherIntegration(IntegrationTestSuite):
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@mark.parametrize("python", [None, "/opt/venv/bin/python"])
|
|
62
|
+
def test_slurm_python_parameter(tmp_path: Path, python: Optional[str]) -> None:
|
|
63
|
+
executor = MagicMock()
|
|
64
|
+
executor.map_array.return_value = []
|
|
65
|
+
auto_executor = MagicMock(return_value=executor)
|
|
66
|
+
|
|
67
|
+
config = OmegaConf.create(
|
|
68
|
+
{
|
|
69
|
+
"hydra": {
|
|
70
|
+
"job": {"name": "test"},
|
|
71
|
+
"sweep": {"dir": str(tmp_path / "sweep")},
|
|
72
|
+
"launcher": OmegaConf.structured(SlurmQueueConf),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
config.hydra.launcher.python = python
|
|
77
|
+
launcher = instantiate(
|
|
78
|
+
config.hydra.launcher,
|
|
79
|
+
_target_whitelist_=(
|
|
80
|
+
"hydra_plugins.hydra_submitit_launcher.submitit_launcher.SlurmLauncher"
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
launcher.config = config
|
|
84
|
+
|
|
85
|
+
with patch.object(submitit, "AutoExecutor", auto_executor):
|
|
86
|
+
assert launcher.launch([[]], initial_job_idx=0) == []
|
|
87
|
+
|
|
88
|
+
auto_executor.assert_called_once_with(
|
|
89
|
+
cluster="slurm",
|
|
90
|
+
folder=str(tmp_path / "sweep" / ".submitit" / "%j"),
|
|
91
|
+
slurm_max_num_timeout=0,
|
|
92
|
+
slurm_python=python,
|
|
93
|
+
)
|
|
94
|
+
assert "slurm_python" not in executor.update_parameters.call_args.kwargs
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@mark.parametrize("tasks_per_node", [1, None])
|
|
98
|
+
def test_slurm_tasks_per_node_is_optional_with_compatible_default(
|
|
99
|
+
tmp_path: Path, tasks_per_node: Optional[int]
|
|
100
|
+
) -> None:
|
|
101
|
+
assert SlurmQueueConf().tasks_per_node == 1
|
|
102
|
+
|
|
103
|
+
executor = MagicMock()
|
|
104
|
+
executor.map_array.return_value = []
|
|
105
|
+
config = OmegaConf.create(
|
|
106
|
+
{
|
|
107
|
+
"hydra": {
|
|
108
|
+
"job": {"name": "test"},
|
|
109
|
+
"sweep": {"dir": str(tmp_path / "sweep")},
|
|
110
|
+
"launcher": OmegaConf.structured(SlurmQueueConf),
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
config.hydra.launcher.tasks_per_node = tasks_per_node
|
|
115
|
+
launcher = instantiate(
|
|
116
|
+
config.hydra.launcher,
|
|
117
|
+
_target_whitelist_=(
|
|
118
|
+
"hydra_plugins.hydra_submitit_launcher.submitit_launcher.SlurmLauncher"
|
|
119
|
+
),
|
|
120
|
+
)
|
|
121
|
+
launcher.config = config
|
|
122
|
+
|
|
123
|
+
with patch.object(submitit, "AutoExecutor", return_value=executor):
|
|
124
|
+
assert launcher.launch([[]], initial_job_idx=0) == []
|
|
125
|
+
|
|
126
|
+
assert (
|
|
127
|
+
executor.update_parameters.call_args.kwargs["tasks_per_node"] == tasks_per_node
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_example(tmpdir: Path) -> None:
|
|
132
|
+
run_python_script(
|
|
133
|
+
[
|
|
134
|
+
"example/my_app.py",
|
|
135
|
+
"-m",
|
|
136
|
+
f"hydra.sweep.dir={tmpdir}",
|
|
137
|
+
"hydra/launcher=submitit_local",
|
|
138
|
+
],
|
|
139
|
+
allow_warnings=True,
|
|
140
|
+
)
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from typing import Type
|
|
4
|
-
|
|
5
|
-
from hydra.core.plugins import Plugins
|
|
6
|
-
from hydra.plugins.launcher import Launcher
|
|
7
|
-
from hydra.test_utils.launcher_common_tests import (
|
|
8
|
-
IntegrationTestSuite,
|
|
9
|
-
LauncherTestSuite,
|
|
10
|
-
)
|
|
11
|
-
from hydra.test_utils.test_utils import chdir_plugin_root, run_python_script
|
|
12
|
-
from pytest import mark
|
|
13
|
-
|
|
14
|
-
from hydra_plugins.hydra_submitit_launcher import submitit_launcher
|
|
15
|
-
|
|
16
|
-
chdir_plugin_root()
|
|
17
|
-
|
|
18
|
-
pytestmark = mark.filterwarnings("ignore:pkg_resources is deprecated as an API:Warning")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@mark.parametrize(
|
|
22
|
-
"cls", [submitit_launcher.LocalLauncher, submitit_launcher.SlurmLauncher]
|
|
23
|
-
)
|
|
24
|
-
def test_discovery(cls: Type[Launcher]) -> None:
|
|
25
|
-
# Tests that this plugin can be discovered via the plugins subsystem when looking for Launchers
|
|
26
|
-
assert cls.__name__ in [x.__name__ for x in Plugins.instance().discover(Launcher)]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@mark.parametrize(
|
|
30
|
-
"launcher_name, overrides", [("submitit_local", ["hydra.launcher.timeout_min=2"])]
|
|
31
|
-
)
|
|
32
|
-
class TestSubmititLauncher(LauncherTestSuite):
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@mark.parametrize(
|
|
37
|
-
"task_launcher_cfg, extra_flags",
|
|
38
|
-
[
|
|
39
|
-
(
|
|
40
|
-
{},
|
|
41
|
-
[
|
|
42
|
-
"-m",
|
|
43
|
-
"hydra/hydra_logging=disabled",
|
|
44
|
-
"hydra/job_logging=disabled",
|
|
45
|
-
"hydra/launcher=submitit_local",
|
|
46
|
-
"hydra.launcher.gpus_per_node=0",
|
|
47
|
-
"hydra.launcher.timeout_min=1",
|
|
48
|
-
],
|
|
49
|
-
),
|
|
50
|
-
],
|
|
51
|
-
)
|
|
52
|
-
class TestSubmititLauncherIntegration(IntegrationTestSuite):
|
|
53
|
-
pass
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_example(tmpdir: Path) -> None:
|
|
57
|
-
run_python_script(
|
|
58
|
-
[
|
|
59
|
-
"example/my_app.py",
|
|
60
|
-
"-m",
|
|
61
|
-
f"hydra.sweep.dir={tmpdir}",
|
|
62
|
-
"hydra/launcher=submitit_local",
|
|
63
|
-
],
|
|
64
|
-
allow_warnings=True,
|
|
65
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|