Skip to content

Commit 1985618

Browse files
Remove unused lsf_version function for Python 3.12 and fix never awaited error for LSFCluster (#646)
* Remove unused lsf_version function for Python 3.12 #644 * Fix _call never awaited * Fix linting --------- Co-authored-by: Jacob Tomlinson <[email protected]>
1 parent c2bb22c commit 1985618

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

conftest.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@ def pytest_runtest_setup(item):
7070
item.add_marker(pytest.mark.xfail(reason=xfail[env]))
7171

7272

73-
@pytest.fixture(autouse=True)
74-
def mock_lsf_version(monkeypatch, request):
75-
# Monkey-patch lsf_version() UNLESS the 'lsf' environment is selected.
76-
# In that case, the real lsf_version() function should work.
77-
markers = list(request.node.iter_markers())
78-
if any("lsf" in marker.args for marker in markers):
79-
return
80-
81-
try:
82-
dask_jobqueue.lsf.lsf_version()
83-
except OSError:
84-
# Provide a fake implementation of lsf_version()
85-
monkeypatch.setattr(dask_jobqueue.lsf, "lsf_version", lambda: "10")
86-
87-
8873
all_envs = {
8974
None: LocalCluster,
9075
"pbs": PBSCluster,

dask_jobqueue/lsf.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
from distutils.version import LooseVersion
2-
31
import logging
42
import math
53
import os
6-
import re
7-
import subprocess
8-
import toolz
94

105
import dask
116

@@ -113,7 +108,7 @@ def __init__(
113108
async def _submit_job(self, script_filename):
114109
if self.use_stdin:
115110
piped_cmd = [self.submit_command + "< " + script_filename + " 2> /dev/null"]
116-
return self._call(piped_cmd, shell=True)
111+
return await self._call(piped_cmd)
117112
else:
118113
result = await super()._submit_job(script_filename)
119114
return result
@@ -239,10 +234,3 @@ class LSFCluster(JobQueueCluster):
239234
job=job_parameters, cluster=cluster_parameters
240235
)
241236
job_cls = LSFJob
242-
243-
244-
@toolz.memoize
245-
def lsf_version():
246-
out, _ = subprocess.Popen("lsid", stdout=subprocess.PIPE).communicate()
247-
version = re.search(r"(\d+\.)+\d+", out.decode()).group()
248-
return LooseVersion(version)

0 commit comments

Comments
 (0)