projects
/
htsworkflow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
76571c0
)
Allow overriding the queued commands environment.
author
Diane Trout
<diane@caltech.edu>
Tue, 5 May 2009 17:56:11 +0000
(17:56 +0000)
committer
Diane Trout
<diane@caltech.edu>
Tue, 5 May 2009 17:56:11 +0000
(17:56 +0000)
htsworkflow/util/queuecommands.py
patch
|
blob
|
history
diff --git
a/htsworkflow/util/queuecommands.py
b/htsworkflow/util/queuecommands.py
index 2227516aecda32491eeffe9c6548224d91eb56c4..23fff168e5337084804758569c884b6084da168b 100644
(file)
--- a/
htsworkflow/util/queuecommands.py
+++ b/
htsworkflow/util/queuecommands.py
@@
-16,7
+16,7
@@
class QueueCommands(object):
finish.
"""
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.
"""
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.running = {}
self.N = N
self.cwd = cwd
+ self.env = env
def under_process_limit(self):
"""
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)
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)))
self.running[p.stdout] = p
queue_log.info("Created process %d from %s" % (p.pid, str(cmd)))