Skip to content

Commit

Permalink
disable shell=True; interface change
Browse files Browse the repository at this point in the history
  • Loading branch information
chexov committed Dec 1, 2010
1 parent 750c583 commit 6055729
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions queueit
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def qwrapper(tube_in, tube_out, worker_cmd):
qconn_out.use(tube_out)

LOG.info(u"QHOST: %s, QPORT %s, TTR %s, Watching queues: %s" % (QHOST, QPORT, QTTR, qconn_in.watching()) )

while True:
job = qconn_in.reserve(timeout=QTIMEOUT)
if not job:
Expand All @@ -195,11 +194,11 @@ def qwrapper(tube_in, tube_out, worker_cmd):
if u" ".join(worker_cmd).find('{}') > -1:
cmd = map(lambda arg: arg.replace('{}', job.body), worker_cmd)
else:
cmd = worker_cmd
cmd = list(worker_cmd)
cmd.append(job.body)

LOG.debug(u"Calling command '%s'" % u" ".join(cmd))
retcode = subprocess.call(cmd, shell=True)
retcode = subprocess.call(cmd)
if not retcode == 0:
LOG.error(u"Worker command '%s' was exited with retcode %s" % (cmd, retcode) )
job.bury()
Expand Down Expand Up @@ -261,9 +260,7 @@ if __name__ == "__main__":
else:
qstat()
elif COMMAND == 'q-wrapper':
if len(args) == 2:
qwrapper(args[0], args[1], worker_cmd=[sys.stdin.readline()])
elif len(args) >= 3:
if len(args) >= 3:
qwrapper(args[0], args[1], worker_cmd=args[2:])
else:
print "Usage: %s <queue-in> <queue-out> [<cmd>]\n <cmd> could be sent trough STDIN" % (COMMAND)
Expand Down

0 comments on commit 6055729

Please sign in to comment.