Python Interview Questions
Roy Smith
roy at panix.com
Mon Nov 19 09:30:54 EST 2012
In article <50a9e5cf$0$21863$c3e8da3$76491128 at news.astraweb.com>,
Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> I see. It wasn't clear from your earlier description that the items had
> been post-processed from collections of raw log lines to fixed records.
Well, I did provide the code that does this.
> But it doesn't actually change my analysis any. See below.
>
> By the way, based on the sample data you show, your script is possibly
> broken. You don't record either the line number that raises, or the
> exception raised, so your script doesn't differentiate between different
> errors that happen to occur with similar stack traces.
You really might want to read the code I provided. Here's the reference
again:
https://bitbucket.org/roysmith/python-tools/src/4f8118d175ed/logs/traceba
ck_helper.py
The "header" referred to does indeed contain the exception raised. And
the line numbers are included. Here's a typical output stanza:
2012-11-19T00:00:15+00:00 web5 ËË2012-11-19 00:00:15,831 [2712]:
songza-api IGPhwNU2SJ691cx8 4C0ABFA9-50A974E7-384995 W6D-HSO
173.145.137.54 songza.django.middleware ERROR process_exception() Path =
u'/api/1/station/1459775/next', Exception =
ValueError(u"<SequentialSongPicker: <Station 1459775: u'Old School
105.3'>>: no song ids for mp3",)
/home/songza/env/python/local/lib/python2.7/site-packages/django/core/han
dlers/base.py:111:get_response()
/home/songza/deploy/current/pyza/djapi/decorators.py:11:_wrapped_view_fun
c()
/home/songza/env/python/local/lib/python2.7/site-packages/django/views/de
corators/http.py:45:inner()
/home/songza/deploy/current/pyza/djapi/views.py:1659:station_next()
/home/songza/deploy/current/pyza/models/station.py:660:next_song()
/home/songza/deploy/current/pyza/lib/song_picker.py:327:pick()
> I say "possibly" broken because I don't know what your requirements are.
Our requirements are to scan the logs of a production site and filter
down the gobs and gobs of output (we produced 70 GB of log files
yesterday) into something small enough that a human can see what the
most common failures were. The tool I wrote does that.
The rest of this conversation is just silly. It's turning into getting
hit on the head lessons.
More information about the Python-list
mailing list