def try_using(parallel_type):
 def print_number(number):
  '\n        Simple function to give a simple task to execute.\n        '
  print number
 if (parallel_type == 'multiprocessing'):
  from multiprocessing import Process as Bucket
 elif (parallel_type == 'threading'):
  from threading import Thread as Bucket
 queue = Queue.Queue()
 jobs = JobQueue(5, queue)
 jobs._debug = True
 for x in range(20):
  jobs.append(Bucket(target=print_number, args=[x], kwargs={}))
 jobs.close()
 jobs.run()

def try_using ( parallel_type ) : def print_number ( number ) : print number if ( parallel_type == 'multiprocessing' ) : from multiprocessing import Process as Bucket elif ( parallel_type == 'threading' ) : from threading import Thread as Bucket queue = Queue . Queue ( ) jobs = JobQueue ( 5 , queue ) jobs . _debug = True for x in range ( 20 ) : jobs . append ( Bucket ( target = print_number , args = [ x ] , kwargs = { } ) ) jobs . close ( ) jobs . run ( )
this will run the queue through its paces .