multiprocessing

wxPython + multiprocessing: Checking if a color string is legitimate

I have a wxPython program with two processes: A primary and a secondary one (I'm using the multiprocessing module.) The primary one runs the wxPython GUI, the secondary one does not. However, there is something I would like to do from the secondary process: Given a string that describes a color, to check whether this would be legitimate ...

Python: Spawn parallel child processes on a multi-processor system - use multiprocessor package, subprocess package, XYZ package?

Hi there, I am a Python newbie so please be gentle :) I have a Python script that I want to use as a controller to another Python script. I have a server with 64 processors, so want to spawn up to 64 child processes of this second Python script. The child script is called: %> python create_graphs.py --name=NAME where NAME is somethi...

producer/consumer problem with python multiprocessing

I am writing a server program with one producer and multiple consumers, what confuses me is only the first task producer put into the queue gets consumed, after which tasks enqueued no longer get consumed, they remain in the queue forever. from multiprocessing import Process, Queue, cpu_count from http import httpserv import time def w...

Preventing file handle inheritance in multiprocessing lib

Using multiprocessing on windows it appears that any open file handles are inherited by spawned processes. This has the unpleasant side effect of locking them. I'm interested in either: 1) Preventing the inheritance 2) A way to release the file from the spawned process Consider the following code which works fine on OSX, but crashes o...

Which scripting languages support multi-core programming?

I have written a little python application and here you can see how Task Manager looks during a typical run. While the application is perfectly multithreaded, unsurprisingly it uses only one CPU core. Regardless of the fact that most modern scripting languages support multithreading, scripts can run on one CPU core only. Ruby, Python,...

Problem with exiting a daemonized process

I am writing a daemon program that spawns several other children processes. After I run the stop script, the main process keeps running when it's intended to quit, this really confused me. import daemon, signal from multiprocessing import Process, cpu_count, JoinableQueue from http import httpserv from worker import work class Manager:...

python multiprocessing manager

My problem is: I have 3 procs that would like to share config loaded from the same class and a couple of queues. I would like to spawn another proc as a multiprocessing.manager to share those informations. How can I do that? Could someone purchase a sample code avoiding use of global vars and making use of multiprocessing manager clas...

Problem deploying Python program (packaged with py2exe)

I have a problem: I used py2exe for my program, and it worked on my computer. I packaged it with Inno Setup (still worked on my computer), but when I sent it to a different computer, I got the following error when trying to run the application: "CreateProcess failed; code 14001." The app won't run. (Note: I am using wxPython and the mult...

Is registered atexit handler inherited by spawned child processes?

I am writing a daemon program using python 2.5. In the main process an exit handler is registered with atexit module, it seems that the handler gets called when each child process ends, which is not I expected. I noticed this behavior isn't mentioned in python atexit doc, anybody knows the issue? If this is how it should behave, how c...

Multiprocessing in python with more then 2 levels

I want to do a program and want make a the spawn like this process -> n process -> n process can the second level spawn process with multiprocessing ? using multiprocessinf module of python 2.6 thnx ...

multiprocessing - share objects with file handle attribute between processes

hi ,i am a newbie here ! there is a question about shared resouce with file handle between processes. here are my test code: from multiprocessing import Process,Lock,freeze_support,Queue import tempfile #from cStringIO import StringIO class File(): def __init__(self): self.temp = tempfile.TemporaryFile() #print ...

python singleton into multiprocessing

How can I code to share the same instance of a "singletonic" class among processes? ...

"select" on multiple Python multiprocessing Queues?

What's the best way to wait (without spinning) until something is available in either one of two (multiprocessing) Queues, where both reside on the same system? ...

Comparison of the multiprocessing module and pyro?

I use pyro for basic management of parallel jobs on a compute cluster. I just moved to a cluster where I will be responsible for using all the cores on each compute node. (On previous clusters, each core has been a separate node.) The python multiprocessing module seems like a good fit for this. I notice it can also be used for remo...

Python: Multicore processing?

I've been reading about Python's multiprocessing module. I still don't think I have a very good understanding of what it can do. Let's say I have a quadcore processor and I have a list with 1,000,000 integers and I want the sum of all the integers. I could simply do: list_sum = sum(my_list) But this only sends it to one core. Is i...

How to isolate your program from calls to a "bad" API?

When I developed a piece of (academic) software using Java, I was forced to use an API that was rather badly implemented. This means that calls to this API for a certain set of input data would sometimes never return. This must have been a bug in the software as the algorithms that it offered were deterministic ones, and sometimes it wou...

Is *this* really the best way to start a second JVM from Java code?

This is a followup to my own previous question and I'm kind of embarassed to ask this... But anyway: how would you start a second JVM from a standalone Java program in a system-independent way? And without relying on for instance an env variable like JAVA_HOME as that might point to a different JRE than the one that is currently running....

Python Multiprocessing Exit Elegantly How?

import multiprocessing import time class testM(multiprocessing.Process): def __init__(self): multiprocessing.Process.__init__(self) self.exit = False def run(self): while not self.exit: pass print "You exited!" return def shutdown(self): self.exit = True ...

Python multiprocessing easy way to implement a simple counter?

Hey everyone, I am using multiprocessing in python now. and I am just wondering whether there exists some sort of simple counter variable that each process when they are done processing some task could just increment ( kind of like how much work done in total). I looked up the API for Value, don't think it's mutable. ...

Python Multiprocessing exit error

Hey everyone I am seeing this when I press Ctrl-C to exit my app Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/lib/python2.6/multiprocessing/util.py", line 269, in _exit_function p.join() File "/usr/lib/pyt...