From Stutters, 1 Year ago, written in Python.
This paste is a reply to Subprocesses from Stutters - view diff
  1. #!/usr/bin/env python2
  2.  
  3. import multiprocessing
  4. import subprocess
  5.  
  6. class Test(object):
  7.  
  8.     def calculate(self, (value1, value2, value3)):
  9.         return value1 * 10 * value2 + value3
  10.  
  11. def calculate_orig((value1, value2, value3)):
  12.     return value1 * 10 * value2 + value3
  13.  
  14. if __name__ == '__main__':
  15.     pool = multiprocessing.Pool(None)
  16.  
  17.     numbers = range(100)
  18.     args = ((number, 3, 111) for number in numbers)
  19.  
  20.     results = []
  21.     instance1 = Test()
  22.     for p in args:
  23.         #print p
  24.         #print instance1.calculate(p)
  25.         pass
  26.  
  27.     r = pool.map_async(instance1.calculate, args, callback=results.append)
  28.     r.wait() # Wait on the results
  29.     print results
  30.  

Replies to Re: Subprocesses rss

Title Name Language When
Re: Re: Subprocesses Stutters python 1 Year ago.
captcha