Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60178
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subsequent': 0.05; 'defaults': 0.07; 'assuming': 0.09; 'callback': 0.09; 'exception,': 0.09; 'exception.': 0.09; 'latter': 0.09; 'raises': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'try:': 0.09; 'valueerror:': 0.09; 'bug': 0.12; 'jan': 0.12; 'arg': 0.16; 'attribute.': 0.16; 'dig': 0.16; 'iterable,': 0.16; 'numpy': 0.16; 'operands': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subclass': 0.16; 'subject:skip:m 10': 0.16; 'subject:when': 0.16; 'valueerror,': 0.16; '{})': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'module': 0.19; 'result.': 0.19; 'later': 0.20; 'work,': 0.20; 'appears': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'replace': 0.24; 'skip:e 30': 0.24; '(or': 0.24; 'skip:" 40': 0.26; 'switch': 0.26; 'task': 0.26; 'tracker': 0.26; 'pass': 0.26; 'skip:" 20': 0.27; 'gets': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; '(this': 0.29; 'raise': 0.29; 'code': 0.31; 'exceptions': 0.31; 'file': 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; 'could': 0.34; 'except': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'there': 0.35; 'raising': 0.36; 'subject:?': 0.36; 'so,': 0.37; 'two': 0.37; 'filled': 0.38; 'tasks': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'does': 0.39; 'generating': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'called': 0.40; 'blank': 0.60; 'john': 0.61; 'received:173': 0.61; 'map': 0.64; 'chance': 0.65; 'latest': 0.67; 'between': 0.67; 'broadcast': 0.68; 'evaluate': 0.72; '3.4': 0.84; '81,': 0.84; 'improvement': 0.84; 'received:fios.verizon.net': 0.84; 'try.': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Traceback when using multiprocessing, less than helpful? |
| Date | Thu, 21 Nov 2013 17:37:13 -0500 |
| References | <e92311cb-6cc5-415a-bbf8-544c0c9c6a54@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-254-207.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
| In-Reply-To | <e92311cb-6cc5-415a-bbf8-544c0c9c6a54@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3017.1385073452.18130.python-list@python.org> (permalink) |
| Lines | 67 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1385073452 news.xs4all.nl 15870 [2001:888:2000:d::a6]:39479 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:60178 |
Show key headers only | View raw
On 11/21/2013 12:01 PM, John Ladasky wrote:
This is a case where you need to dig into the code (or maybe docs) a bit
> File ".../evaluate.py", line 81, in evaluate
> result = pool.map(evaluate, bundles) File
> "/usr/lib/python3.3/multiprocessing/pool.py", line 228, in map
> return self._map_async(func, iterable, mapstar, chunksize).get()
The call to _map_async gets a blank MapResult (a subclass of
ApplyResult), queues tasks to fill it in, and returns the filled in
result. This call is designed to always return as task exceptions are
caught and assigned to MapResult._value in both ApplyResult._set and
MapResult._set.
result = MapResult(self._cache, chunksize, len(iterable), callback,
error_callback=error_callback)
self._taskqueue.put((((result._job, i, mapper, (x,), {})
for i, x in enumerate(task_batches)), None))
return result
It is the subsequent call to get() that 'fails', because it raises
the caught exception.
> File "/usr/lib/python3.3/multiprocessing/pool.py", line 564, in get
> raise self._value
ValueError: operands could not be broadcast together with shapes (1,3) (4)
> Notice that no line of numpy appears in the traceback? Still, there
> are three things that make me think that this error is coming from
> numpy.
It comes from one of your tasks as the 'result', and your tasks use numpy.
> If I could only see the line of numpy code which is generating the
> ValueError, I would have a better chance of spotting the bug in my
> code.
Definitely.
> So, WHY isn't there any reference to numpy in my traceback?
I suspect that raising the exception may replace its __traceback__
attribute. Anyway, there are three things I might try.
1. Use 3.3.3 or latest 3.4 to see if there is any improvement in output.
I vaguely remember a tracker issue that might be related.
2. _map_async takes an error_callback arg that defaults to None and
which is passed on to MapResult. When _value is set to an exception,
"error_callback(_value)" is called in ._set() before the later .get()
re-raises it. pool.map does not allow you to set either the (success)
callback or the error_callback, but pool.map_async does (this is the
difference between the two methods). So switch to the latter so you can
pass a function that uses the traceback module to print (or log) the
traceback attached to _value, assuming that there is one.
3. If that does not work, wrap the current body of your task function in
try: <current suite>
except exception as e:
<use traceback module to add traceback to message>
raise e <or a new exception>
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Traceback when using multiprocessing, less than helpful? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-21 09:01 -0800
Re: Traceback when using multiprocessing, less than helpful? Chris Angelico <rosuav@gmail.com> - 2013-11-22 04:24 +1100
Re: Traceback when using multiprocessing, less than helpful? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-21 10:25 -0800
Re: Traceback when using multiprocessing, less than helpful? Chris Angelico <rosuav@gmail.com> - 2013-11-22 07:53 +1100
Re: Traceback when using multiprocessing, less than helpful? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-21 13:19 -0800
Re: Traceback when using multiprocessing, less than helpful? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-21 13:49 -0800
Re: Traceback when using multiprocessing, less than helpful? Ethan Furman <ethan@stoneleaf.us> - 2013-11-21 14:32 -0800
Re: Traceback when using multiprocessing, less than helpful? Terry Reedy <tjreedy@udel.edu> - 2013-11-21 17:37 -0500
Re: Traceback when using multiprocessing, less than helpful? John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-21 19:57 -0800
Re: Traceback when using multiprocessing, less than helpful? Chris Angelico <rosuav@gmail.com> - 2013-11-22 15:24 +1100
Why pickling (was: Traceback when using multiprocessing) John Ladasky <john_ladasky@sbcglobal.net> - 2013-11-22 08:38 -0800
Re: Why pickling (was: Traceback when using multiprocessing) Chris Angelico <rosuav@gmail.com> - 2013-11-23 10:50 +1100
Re: Traceback when using multiprocessing, less than helpful? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-22 09:09 +0000
csiph-web