Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace run_cmd with run_shell_cmd in custom easyblock for CUDAcompat (cudacompat.py) #3112

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions easybuild/easyblocks/c/cudacompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from easybuild.tools.build_log import EasyBuildError, print_warning
from easybuild.tools.config import build_option, IGNORE
from easybuild.tools.filetools import copy_file, find_glob_pattern, mkdir, symlink, which
from easybuild.tools.run import run_cmd
from easybuild.tools.run import run_shell_cmd


class EB_CUDAcompat(Binary):
Expand Down Expand Up @@ -85,12 +85,12 @@ def _run_nvidia_smi(self, args):
if not self.has_nvidia_smi:
raise RuntimeError('Could not find nvidia-smi.')
cmd = 'nvidia-smi ' + args
out, ec = run_cmd(cmd, log_ok=False, log_all=False, regexp=False)
if ec != 0:
raise RuntimeError("`%s` returned exit code %s with output:\n%s" % (cmd, ec, out))
res = run_shell_cmd(cmd, fail_on_error=False)
if res.exit_code != 0:
raise RuntimeError("`%s` returned exit code %s with output:\n%s" % (cmd, res.exit_code, res.output))
else:
self.log.info('`%s` succeeded with output:\n%s' % (cmd, out))
return out.strip().split('\n')
self.log.info('`%s` succeeded with output:\n%s' % (cmd, res.output))
return res.output.strip().split('\n')

def prepare_step(self, *args, **kwargs):
"""Parse and check the compatible_driver_versions value of the EasyConfig"""
Expand Down Expand Up @@ -127,7 +127,7 @@ def extract_step(self):
execpath = self.src[0]['path']
tmpdir = os.path.join(self.builddir, 'tmp')
targetdir = os.path.join(self.builddir, 'extracted')
run_cmd("/bin/sh " + execpath + " --extract-only --tmpdir='%s' --target '%s'" % (tmpdir, targetdir))
run_shell_cmd("/bin/sh " + execpath + " --extract-only --tmpdir='%s' --target '%s'" % (tmpdir, targetdir))
self.src[0]['finalpath'] = targetdir

def test_step(self):
Expand Down