whisper.py uses assertions rather than exceptions

Bug #514349 reported by Elliot Murphy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Graphite
Fix Released
Medium
chrismd

Bug Description

whisper.py makes use of assertions in a way that is not so idiomatic for python. For example whisper.create() uses assert to test for incorrect input. The more pythonic way would be to raise exceptions there and reserve assert for cases which should never happen.

Related branches

Revision history for this message
chrismd (chrismd) wrote :

You are absolutely right, an explicit ValueError or TypeError would be much better suited in places where I often simply assert. It's an old bad habit that I've mostly grown out of, whisper happens to be pretty old code. I also went through a brief phase in which I disliked vertical whitespace. Fortunately it only lasted a weekend. Unfortunately that was the weekend I wrote whisper.

Picasso had his blue period right? :)

Changed in graphite:
status: New → Confirmed
assignee: nobody → chrismd (chrismd)
importance: Undecided → Medium
milestone: none → 0.9.6
Revision history for this message
Elliot Murphy (statik) wrote :

Hi Chris, thanks for targeting this bug to the 0.96 milestone. I've found a sponsor for my Debian package of whisper, and am very close to having everything ready for upload to Debian and then sync to Ubuntu. My sponsor feels strongly that this bug should be fixed before uploading the initial version of whisper to Debian. It is not necessary to wait for the 0.96 release, I am able to cherry pick a patch from trunk into the 0.95 package with no problem.

I don't know if I'll have time to work on such a patch myself, but I wanted to let you know the current status of packaging and why I filed this bug report :)

Thanks for all your work on graphite! Once I get whisper packaging finished, I'll likely work on carbon.

Revision history for this message
chrismd (chrismd) wrote :

Hey just so you know I'm going to try and knock this bug out tomorrow morning. Also fyi another user recently sent me a patch to do debian packaging: https://bugs.launchpad.net/graphite/+bug/522873

Let me know what you think.

Revision history for this message
Elliot Murphy (statik) wrote : Re: [Bug 514349] Re: whisper.py uses assertions rather than exceptions

On Wed, Feb 24, 2010 at 2:14 AM, chrismd <email address hidden> wrote:
> Hey just so you know I'm going to try and knock this bug out tomorrow
> morning.

Great! I wonder if you got a chance to look at the branch I submitted for this?
https://code.edge.launchpad.net/~statik/graphite/cleanup-assertions/+merge/18780

> Also fyi another user recently sent me a patch to do debian
> packaging: https://bugs.launchpad.net/graphite/+bug/522873
>
> Let me know what you think.

Excellent! I commented on the other bug. It would be ideal to get that
packaging stuff added into the debian python packaging team
repository, and uploaded to debian, then it can flow naturally into
Ubuntu.

--
Elliot Murphy | https://launchpad.net/~statik/

Revision history for this message
Allan Bailey (zirpu) wrote : Re: [Bug 514349] Re: whisper.py uses assertions rather than exceptions

I'll take a look when I can. I'm on pager rotation and we're in
the middle of a big push. so less time to work on graphite.

BTW, I need to push my changes to our branch. I'm trying to fix
the MetricCache so that it doesn't fall over when overwhelmed
with about 1M/minute metrics. It ends up not able to clear the queue
of metrics from rabbitmq and spends all its time in the metriccache.
our fix was to for the users/engineers to only send metrics at 1 minute
intervals instead of a default 10second interval. Initially I tried
to use Redis, but I need to wrap my head around Twisted again to
get it to work properly. Probably will run it w/in a thread or something
for simplicity.

-allan

--- On Tue, 2/23/10, chrismd <email address hidden> wrote:

> From: chrismd <email address hidden>
> Subject: [Bug 514349] Re: whisper.py uses assertions rather than exceptions
> To: <email address hidden>
> Date: Tuesday, February 23, 2010, 11:14 PM
> Hey just so you know I'm going to try
> and knock this bug out tomorrow
> morning. Also fyi another user recently sent me a patch to
> do debian
> packaging: https://bugs.launchpad.net/graphite/+bug/522873
>
> Let me know what you think.
>
> --
> whisper.py uses assertions rather than exceptions
> https://bugs.launchpad.net/bugs/514349
> You received this bug notification because you are
> subscribed to
> Graphite.
>

Revision history for this message
Allan Bailey (zirpu) wrote :

wow. yahoo mail sucks. it totally hid from me i was replying to a bug.
:-)

-allan

--- On Tue, 2/23/10, chrismd <email address hidden> wrote:

> From: chrismd <email address hidden>
> Subject: [Bug 514349] Re: whisper.py uses assertions rather than exceptions
> To: <email address hidden>
> Date: Tuesday, February 23, 2010, 11:14 PM
> Hey just so you know I'm going to try
> and knock this bug out tomorrow
> morning. Also fyi another user recently sent me a patch to
> do debian
> packaging: https://bugs.launchpad.net/graphite/+bug/522873
>
> Let me know what you think.
>
> --
> whisper.py uses assertions rather than exceptions
> https://bugs.launchpad.net/bugs/514349
> You received this bug notification because you are
> subscribed to
> Graphite.
>

chrismd (chrismd)
Changed in graphite:
status: Confirmed → Fix Committed
chrismd (chrismd)
Changed in graphite:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.