Skip to content

Commit

Permalink
Redirect stderr to /dev/null of lsf conf queries (#3751)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanesarango authored Aug 25, 2021
1 parent 8aed048 commit 7a8c923
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/toil/batchSystems/lsfHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import fnmatch
import logging
import os
import re
import subprocess
Expand All @@ -37,6 +38,8 @@
DEFAULT_RESOURCE_UNITS = "MB"
LSF_JSON_OUTPUT_MIN_VERSION = "10.1.0.2"

logger = logging.getLogger(__name__)


def find(basedir, string):
"""
Expand Down Expand Up @@ -109,8 +112,9 @@ def apply_bparams(fn):
"""
cmd = ["bparams", "-a"]
try:
output = subprocess.check_output(cmd).decode('utf-8')
except:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
except subprocess.CalledProcessError as exc:
logger.debug(exc.output.decode('utf-8'))
return None
return fn(output.split("\n"))

Expand All @@ -121,8 +125,9 @@ def apply_lsadmin(fn):
"""
cmd = ["lsadmin", "showconf", "lim"]
try:
output = subprocess.check_output(cmd).decode('utf-8')
except:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8')
except subprocess.CalledProcessError as exc:
logger.debug(exc.output.decode('utf-8'))
return None
return fn(output.split("\n"))

Expand Down

0 comments on commit 7a8c923

Please sign in to comment.