python multiprocessing with map_sync - catching problems -


I am trying to use a multiprocessing package in Python.

I have a code that is designed to generate output based on the collection processes that have many processors ...

  years = [2013] days = [1,2,3,4,5,6,7,8,9, 10] months = [8] hours = [0, 6, 12, 18] ens = [1, 2, 3, 4] nuns = Lane (days) * lane (hours) hours = hours * lane (days) year = days * days (days) * lane (hours) month = months * lane (days) * lane (hours) temporarily = [days] D: temp.append ([d] * lane (hour)) = [x in the sublist for x in the sublist for hours] hour = hour * lane (d N) nens = ens * len (day)  

In this example I have 260 times that are near different processors.

t1 = c [:]. Map_sync (doCoolStuff, year, month, day, hour, nanus, [option] * lane (day))

There are times when there is a missing / incomplete data When this happens, then kills all the processes on other nodes. Is there any way to catch these examples? I'm not sure / works here except for try.

Thanks

I can think of two options here To make sure that the doCoolStuff function never throws an exception, and does not return any or nothing in return, which indicates the error, the second option is to use the iPad instead of the map_sync, and at once the iterator In addition to an element, block / try inside.

  it = c [:] Imap (doCoolStuff (option) * lane (day)) t1 = [] while true: try: t1.append (it.next () except for StopIteration: Except exception: E: Print "Exception caught:% s "% E"  

This approach works with the multiprocessing module, and it seems that the IPathon is equal to (), so it should also work for it.

Edit: If you go with the first option, exception (none, [], or any other value, where bool value) == incorrect ) From your final list like this:

  t1 = filter (none, c [:]. Map_sync (doCoolStuff, year, ...))  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -