Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (25 sloc) 0.641 kb
24496483 »
2012-05-31 Py3k support
1 import billiard as mp
2 from setproctitle import setproctitle
3 import time
49d1344e »
2012-04-23 Stupid test
4
24496483 »
2012-05-31 Py3k support
5 def initfun():
6 setproctitle("Pool: %s" % mp.current_process()._name)
49d1344e »
2012-04-23 Stupid test
7
8 def f(x):
24496483 »
2012-05-31 Py3k support
9 print("TASK")
10 return True
49d1344e »
2012-04-23 Stupid test
11
12
13 def cb(res):
14 print("GOT: %r" % (res, ))
15
16
17
18 def main():
24496483 »
2012-05-31 Py3k support
19 mp.forking_enable(False)
20 initfun()
21 x = mp.Pool(1, initializer=initfun)
22 time.sleep(10)
23 x.apply_async(f, ("x" * 1024**2, ), callback=cb)
24 time.sleep(3)
25 x.apply_async(f, ("x" * (1024**2), ), callback=cb)
26 time.sleep(3)
27 x.apply_async(f, ("x" * (1024**2), ), callback=cb)
28
29 time.sleep(30)
49d1344e »
2012-04-23 Stupid test
30
31 x.close()
32 x.join()
33
34
35 if __name__ == "__main__":
36 main()
Something went wrong with that request. Please try again.