def add_generic_options(par) : par.add_argument('--tmpdir', type=str, default=tmpdir(), help='temporary directory') par.add_argument('--threads', type=int, default=num_threads(), help='number of threads') par.add_argument('-v', '--verbose', action='count', default=2, help='set verbosity, can be set multiple times e.g.: -vvv')
def __init__(self, qtimeout=1, maxsize=0): if maxsize == 0 : maxsize = num_threads() * 2 self.log = get_log() self.q = Queue.Queue(maxsize) self.workers = self._init_workers(num_threads()) self.q_timeout = qtimeout self.running = False self.no_more_jobs = False self.jobs_completed = 0 self.jobs_counter = itertools.count(start=1) self.start()