Skip to content

Commit 7a8c923

Browse files
authored
Redirect stderr to /dev/null of lsf conf queries (#3751)
1 parent 8aed048 commit 7a8c923

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/toil/batchSystems/lsfHelper.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2323
# SOFTWARE.
2424
import fnmatch
25+
import logging
2526
import os
2627
import re
2728
import subprocess
@@ -37,6 +38,8 @@
3738
DEFAULT_RESOURCE_UNITS = "MB"
3839
LSF_JSON_OUTPUT_MIN_VERSION = "10.1.0.2"
3940

41+
logger = logging.getLogger(__name__)
42+
4043

4144
def find(basedir, string):
4245
"""
@@ -109,8 +112,9 @@ def apply_bparams(fn):
109112
"""
110113
cmd = ["bparams", "-a"]
111114
try:
112-
output = subprocess.check_output(cmd).decode('utf-8')
113-
except:
115+
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
116+
except subprocess.CalledProcessError as exc:
117+
logger.debug(exc.output.decode('utf-8'))
114118
return None
115119
return fn(output.split("\n"))
116120

@@ -121,8 +125,9 @@ def apply_lsadmin(fn):
121125
"""
122126
cmd = ["lsadmin", "showconf", "lim"]
123127
try:
124-
output = subprocess.check_output(cmd).decode('utf-8')
125-
except:
128+
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
129+
except subprocess.CalledProcessError as exc:
130+
logger.debug(exc.output.decode('utf-8'))
126131
return None
127132
return fn(output.split("\n"))
128133

0 commit comments

Comments
 (0)