multiprocessing

perl process queue

I have a Perl script which forks a number of sub-processes. I'd like to have some kind of functionality like xargs --max-procs=4 --max-args=1 or make -j 4, where Perl will keep a given number of processes running until it runs out of work. It's easy to say fork four process and wait for them all to complete, and then fork another fou...

python - multiprocessing queue put nowait blocking question

hi.. got a test function, used by a worker process. the nextqueue has been set to have a size of 1, for a single element.. foo1 can be invoked mutiple times on the 1st time through, the queue gets set correctly all other times.. it appears that the function blacks/gets stuck on the put_nowait the queue is created by importing the m...

Sharing data between processes in Python

I have a complex data structure (user-defined type) on which a large number of independent calculations are performed. The data structure is basically immutable. I say basically, because though the interface looks immutable, internally some lazy-evaluation is going on. Some of the lazily calculated attributes are stored in dictionaries (...

Which processes an image faster?

Is it matlab or opencv ...

How to connect with process by ID in Python

I wrote application and other application which will connect to first application. I have process ID of these processes and know how to get process ID of second application in first. But I dont know how can I connect to process knowing their id. Any suggestions? I use windows 32bit ...

Pipe between current process and other process

I want to make pipe or queue in Python between one process (current) and other existing in system. how can I make it? I know current and other proces ID. I work on Windows 32bit. ...

Is there a multi-process unit testing framework / junit addon?

Imagine two servers (each within an own jvm process) which communicate using some form of messages (e.g. simple producer/consumer) I'd like to write unit tests that will test the behaviour of these two servers. My questions are: Are there some frameworks (or a junit addon) for this problem? I'd like to run a junit test class (or even ...

pyglet silent exit with multiprocessing?

Pyglet exits unexpectedly and silently if I do this: from multiprocessing import Process import pyglet from pyglet.gl import * def myProcess(): w = pyglet.window.Window() pyglet.app.run() p = Process(target = myProcess) p.start() while p.is_alive(): pass It works as expected (opens an empty window and sits there) if I ch...

Help running Python multiprocessing program under SGE

I have a Python program that runs multiple threads using the multiprocessing module. The program runs fine when executed on a stand-alone machine with multiple cores, using all cores, or on a cluster when executing from the shell directly. However, when trying to run it through SGE (Sun Grid Engine), either through a job script or usin...

Managing multiple-processes: What are the common strategies?

While multithreading is faster in some cases, sometimes we just want to spawn multiple worker processes to do work. This has the benefits of not crashing the main app if one of the worker crashes, and that the user doesn't need to worry a lot about inter-locking stuffs. COM+'s Application Pooling seems like a good way to achieve this on...

python -> multiprocessing module

Hi all, Here's what I am trying to accomplish - I have about a million files which I need to parse & append the parsed content to a single file. Since a single process takes ages, this option is out. Not using threads in Python as it essentially comes to running a single process (due to GIL). Hence using multiprocessing module. i.e. s...

How to know if a Python multiprocessing.Lock is released or not?

>>> l = Lock() >>> l.acquire() True >>> l.release() >>> l.release() Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: semaphore or lock released too many times throws a ValueError exception. How can I prevent to release a lock more than once? Something like l.is_released() ? ...

Does functools.partial not work with multiprocessing.Pool.map?

I have code that, simplified down, looks like this: run = functools.partial(run, grep=options.grep, print_only=options.print_only, force=options.force) if not options.single and not options.print_only and options.n > 0: pool = multiprocessing.Pool(options.n) Map = pool.map else: Map = map for f in args: with open(f) as fh:...

Broken Pipe when Using Python Multiprocessing Managers (BaseManager/SyncManager) to Share Queue with Remote Machines

In the last month, we've had a persistent problem with the Python 2.6.x multiprocessing package when we've tried to use it to share a queue among several different (linux) computers. I've posed this question directly to Jesse Noller as well since we haven't yet found anything that elucidates the issue on StackOverflow, Python docs, sour...

Sharing a complex object between Python processes?

I have a fairly complex Python object that I need to share between multiple processes. I launch these processes using multiprocessing.Process. When I share an object with multiprocessing.Queue and multiprocessing.Pipe in it, they are shared just fine. But when I try to share an object with other non-multiprocessing-module objects, it see...

python2.5 multiprocessing Pool

I have python2.5 and multiprocessoring (get from http://code.google.com/p/python-multiprocessing/) This simple code (get from docs), works very strange from time to time, sometimes it ok, but sometimes it throw timeout ex or hang my Windows (Vista), only reset helps :) Why this can happen? from multiprocessing import Pool def f(x): ...

How do I know when a child process died?

In my class I run 4 process. from multiprocessing import Process procs = ( Process(target=ClassOne, name='ClassOne'), Process(target=ClassTwo, name='ClassTwo'), Process(target=ClassThree, name='ClassThree'), Process(target=ClassFour, name='ClassFour'), ) for p in...

programmatically executing and terminating a long-running batch process in python

Hi guys, I have been searching for a way to start and terminate a long-running "batch jobs" in python. Right now I'm using "os.system()" to launch a long-running batch job inside each child process. As you might have guessed, "os.system()" spawns a new process inside that child process (grandchild process?), so I cannot kill the batch ...

python multiprocessing pool, wait for processes and restart custom processes

Hi I used python multiprocessing and do wait of all processes with this code: ... results = [] for i in range(num_extract): url = queue.get(timeout=5) try: print "START PROCESS!" result = pool.apply_async(process, [host,url],callback=callbac...

Python multiprocessing handling sessions

I have a script receiveing data from a socket, each data contains a sessionid that a have to keep track of, foreach incomming message, i'm opening a new process with the multiprocessing module, i having trouble to figure out a way to keep track of the new incoming messages having the same sessionid. For example: 100100|Hello -- (open ...