Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/file/2b3cad50c2b1/utils/pool
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 17:25:50 2013
Кодировка:
allpy: 2b3cad50c2b1 utils/pool

allpy

view utils/pool @ 1106:2b3cad50c2b1

Partially reversed [afed1f] (see #49) As explained in the ticket, in real life usecases having a monomer belong to several sequences is sometimes extremely useful. ANY approach to attribution of monomer to only one sequence will be either confusing or hindering. * Removed `monomer.sequence` attribute * Removed unncecessary specialcasing in pickle * Removed unused tests * Restored APIs to backward-compatible * Added deprecated messages to the restored APIs
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Sun, 10 Jun 2012 16:08:47 +0400
parents
children
line source
1 #!/usr/bin/python
2 import subprocess
3 import os
4 import shlex
5 import optparse
7 p = optparse.OptionParser()
8 p.add_option('-n', '--size', type=int, help='Pool size')
9 p.add_option('-c', '--cmd',
10 help='Command template. Insert {} for argument.'
11 ' Put the argument in double quotes if it may contain spaces.')
12 options, args = p.parse_args()
14 spawned = 0
15 for arg in args:
16 if spawned > options.size:
17 os.wait()
18 spawned -= 1
19 cmd = shlex.split(options.cmd.replace('{}', arg))
20 subprocess.Popen(cmd)
21 spawned += 1
23 try:
24 while True:
25 os.wait()
26 except Exception:
27 pass
29 # vim: set ts=4 sts=4 et sw=4: