From 2d89edc89053fef1ce4b8e81211faf348134e0e5 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Tue, 5 May 2009 17:56:11 +0000 Subject: [PATCH] Allow overriding the queued commands environment. --- htsworkflow/util/queuecommands.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htsworkflow/util/queuecommands.py b/htsworkflow/util/queuecommands.py index 2227516..23fff16 100644 --- a/htsworkflow/util/queuecommands.py +++ b/htsworkflow/util/queuecommands.py @@ -16,7 +16,7 @@ class QueueCommands(object): finish. """ - def __init__(self, cmd_list, N=0, cwd=None): + def __init__(self, cmd_list, N=0, cwd=None, env=None): """ cmd_list is a list of elements suitable for subprocess N is the number of simultanious processes to run. @@ -30,6 +30,7 @@ class QueueCommands(object): self.running = {} self.N = N self.cwd = cwd + self.env = env def under_process_limit(self): """ @@ -53,7 +54,11 @@ class QueueCommands(object): while (len(self.to_run) > 0) and self.under_process_limit(): queue_log.info('%d left to run', len(self.to_run)) cmd = self.to_run.pop(0) - p = subprocess.Popen(cmd, stdout=PIPE, cwd=self.cwd, shell=True) + p = subprocess.Popen(cmd, + stdout=PIPE, + shell=True, + cwd=self.cwd, + env=self.env) self.running[p.stdout] = p queue_log.info("Created process %d from %s" % (p.pid, str(cmd))) -- 2.30.2