Skip to content

Commit

Permalink
added: prefix to decrease load on nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
adobdin committed Dec 28, 2015
1 parent ad09259 commit 4008643
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,20 @@ def launch_cmd(command, timeout):


def ssh_node(ip, command, sshopts='', sshvars='', timeout=15, filename=None,
outputfile=None):
outputfile=None, prefix='nice -n 19 ionice -c 3'):
if (ip in ['localhost', '127.0.0.1']) or ip.startswith('127.'):
logging.info("skip ssh")
bstr = "%s timeout '%s' bash -c " % (
sshvars, timeout)
bstr = "%s timeout '%s' %s bash -c " % (
sshvars, timeout, prefix)
else:
logging.info("exec ssh")
# base cmd str
bstr = "timeout '%s' ssh -t -T %s '%s' '%s' " % (
timeout, sshopts, ip, sshvars)
if filename is None:
cmd = bstr + '"' + command + '"'
cmd = bstr + '"' + prefix + ' ' + command + '"'
else:
cmd = bstr + " 'bash -s' < '%s'" % (filename)
cmd = bstr + " '%s bash -s' < '%s'" % (prefix, filename)
# logging.info(cmd)
if outputfile is not None:
cmd += ' > "' + outputfile + '"'
Expand Down

0 comments on commit 4008643

Please sign in to comment.