turntable/spin.py
def thread(function, sequence, cores=None, runSeries=False, quiet=False):
    '''sets up the threadpool with map for parallel processing'''

    # Make the Pool of workes
    if cores is None:
        pool = ThreadPool()
    else:
        pool = ThreadPool(cores)

    # Operate on the list of subjects with the requested function
    # in the split threads
    tic = time.time()
    if runSeries is False:
        try:
            results = pool.map(function, sequence)
            # close the pool and wiat for teh work to finish
            pool.close()
            pool.join()
        except:
            print 'thread Failed... running in series :-('
            results = series(sequence, function)
    else:
        results = series(sequence, function)
    toc = time.time()
    elapsed = toc - tic

    if quiet is False:
        if cores is None:
            print "Elapsed time: %s  :-)\n" % str(elapsed)
        else:
            print "Elapsed time: %s  on %s threads :-)\n" % (str(elapsed), str(cores))
    # Noes:
    # import functools
    # abc = map(functools.partial(sb.dist, distName = 'weibull'), wbldfList)

    return results
def thread(function, sequence, cores=None, runSeries=False, quiet=False):
    '''sets up the threadpool with map for parallel processing'''

    # Make the Pool of workes
    if cores is None:
        pool = ThreadPool()
    else:
        pool = ThreadPool(cores)

    # Operate on the list of subjects with the requested function
    # in the split threads
    tic = time.time()
    if runSeries is False:
        try:
            results = pool.map(function, sequence)
            # close the pool and wiat for teh work to finish
            pool.close()
            pool.join()
        except:
            print 'thread Failed... running in series :-('
            results = series(sequence, function)
    else:
        results = series(sequence, function)
    toc = time.time()
    elapsed = toc - tic

    if quiet is False:
        if cores is None:
            print "Elapsed time: %s  :-)\n" % str(elapsed)
        else:
            print "Elapsed time: %s  on %s threads :-)\n" % (str(elapsed), str(cores))
    # Noes:
    # import functools
    # abc = map(functools.partial(sb.dist, distName = 'weibull'), wbldfList)

    return results
def thread ( function , sequence , cores = None , runSeries = False , quiet = False ) : # Make the Pool of workes if cores is None : pool = ThreadPool ( ) else : pool = ThreadPool ( cores ) # Operate on the list of subjects with the requested function # in the split threads tic = time . time ( ) if runSeries is False : try : results = pool . map ( function , sequence ) # close the pool and wiat for teh work to finish pool . close ( ) pool . join ( ) except : print 'thread Failed... running in series :-(' results = series ( sequence , function ) else : results = series ( sequence , function ) toc = time . time ( ) elapsed = toc - tic if quiet is False : if cores is None : print "Elapsed time: %s  :-)\n" % str ( elapsed ) else : print "Elapsed time: %s  on %s threads :-)\n" % ( str ( elapsed ) , str ( cores ) ) # Noes: # import functools # abc = map(functools.partial(sb.dist, distName = 'weibull'), wbldfList) return results
sets up the threadpool with map for parallel processing
sets up the threadpool with map for parallel processing