Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions src/rocks-command/remove/host/plugin_sge.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
import subprocess
import shlex
import rocks.commands
import syslog

class Plugin(rocks.commands.Plugin):

Expand All @@ -112,24 +113,27 @@ def run(self, host):
# remove the host from every defined SGE 'host group'
#
cmd = 'qconf -shgrpl'
p = subprocess.Popen(shlex.split(cmd), stdin = subprocess.PIPE,
stdout = subprocess.PIPE, stderr = subprocess.PIPE)
try:
p = subprocess.Popen(shlex.split(cmd), stdin = subprocess.PIPE,
stdout = subprocess.PIPE, stderr = subprocess.PIPE)

for group in p.stdout.readlines():
cmd = 'qconf -dattr hostgroup hostlist %s %s' % \
(host, group)
for group in p.stdout.readlines():
cmd = 'qconf -dattr hostgroup hostlist %s %s' % \
(host, group)

p = subprocess.Popen(shlex.split(cmd),
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)

#
# remove the host as a SGE 'execution host'
#
cmd = 'qconf -de %s' % host
p = subprocess.Popen(shlex.split(cmd),
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)

#
# remove the host as a SGE 'execution host'
#
cmd = 'qconf -de %s' % host
p = subprocess.Popen(shlex.split(cmd),
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
except:
syslog.syslog(syslog.LOG_INFO, 'sge remove fail for %s' % host)