Skip to content

Commit 8c655b4

Browse files
committed
Make get_launcher return None when no launcher
My initial though was that get_launcher should raise an error when no launcher is found on the system since there cannot be any job launcher. I realized that this would break the --doNotLaunch option that users may want to use on system with no launcher, just to create the files.
1 parent f967180 commit 8c655b4

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

smartdispatch/tests/test_utils.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,16 @@ def test_get_launcher(self):
198198
lambda command: launcher if launcher == command else None)
199199

200200
for cluster_name in self.CLUSTER_NAMES:
201-
if cluster_name in utils.MSUB_CLUSTERS:
202-
continue
203-
with self.assertRaises(RuntimeError):
204-
utils.get_launcher(cluster_name)
201+
self._assert_launcher(None, cluster_name)
205202

206203
for idx in range(self.N_RANDOM):
207-
with self.assertRaises(RuntimeError):
208-
utils.get_launcher(self._get_random_string())
204+
self._assert_launcher(None, self._get_random_string())
209205

210206
# Test if command_is_available only returns None
211207
mock_distutils.spawn.find_executable.return_value = None
212208

213209
for cluster_name in self.CLUSTER_NAMES:
214-
if cluster_name in utils.MSUB_CLUSTERS:
215-
continue
216-
with self.assertRaises(RuntimeError):
217-
utils.get_launcher(cluster_name)
210+
self._assert_launcher(None, cluster_name)
218211

219212
for idx in range(self.N_RANDOM):
220-
with self.assertRaises(RuntimeError):
221-
utils.get_launcher(self._get_random_string())
213+
self._assert_launcher(None, self._get_random_string())

smartdispatch/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,4 @@ def get_launcher(cluster_name):
193193
if command_is_available(launcher):
194194
return launcher
195195

196-
raise RuntimeError("No compatible launcher found on the system")
196+
return None

0 commit comments

Comments
 (0)