I have a list (called requestRoster) containing dictionaries (called requests). Items in the query dictionary are things like "requestTime" and "thisURL". For instance:
[ {'thisURL': 'http://localhost/bikes', 'requestTime': datetime.datetime(2012, 10, 18, 0, 41, 34)}, {'thisURL': 'http://localhost/clothing', 'requestTime': datetime.datetime(2012, 10, 18, 0, 41, 35)} ]
I use multiprocessing.Process to create a new process to issue each request.
I would like each process to update requestRoster by adding a response element to each request.
How can i do this?
I tried using multiprocessing.Manager () to create manager.list () and manager.Namespace (). I don't let me do what I want to do, I think because of this: http://docs.python.org/library/multiprocessing.html#multiprocessing.managers.SyncManager.list
I think I could use multiprocessing. Lock () -
- get mutex
- make a copy of requestRoster inside the process
- change localized query
- overwrite the globablised query list with localized
- let go of the mutex
... but it seems a bit complicated, and I wonder if I am missing something simpler. Asynchronous callback will be great.
source share