← Back to team overview

graphite-dev team mailing list archive

Re: settings.py

 

First off, sorry your message sat in a queue for 3 weeks, I've been slacking
on my list moderation duties. My bad.

So what you've come across is somewhere between a bug and a feature. The
problem is that you're probably setting a custom WHISPER_DIR and RRD_DIR in
your local_settings.py, but not DATA_DIRS. Intuitively your local_settings
values make sense, they should change where whisper or rrd data gets stored,
but without setting DATA_DIRS this doesn't happen. Sounds like a bug.

But say you have data in more than one place. Perhaps you have rrd data in
multiple directories or whisper data in multiple directories, you'd have no
way to specify that without setting DATA_DIRS in local_settings.py. But if
DATA_DIRS can be changed in local_settings.py we can't re-define it after
the local_settings import in settings.py. So the ability to set DATA_DIRS in
local_settings.py is also a feature.

This can be fixed of course, but it will require a slightly more complex
patch. What we'd want to do is re-define DATA_DIRS after the local_settings
import if and only if the value of DATA_DIRS is the same before and after
the import, that way we'd pick up WHISPER_DIR/RRD_DIR changes without
blowing away a specified DATA_DIRS setting.

In general feel free to email graphite-dev about whatever Graphite questions
or ideas you have. I'll try to keep up on the moderation duties better. If
you have any other changes you'd like to submit, feel free to submit a bug (
https://bugs.launchpad.net/graphite) or create your own branch and propose a
merge.

Thanks,
Chris

On Thu, Aug 4, 2011 at 2:53 PM, Stevens, Cody <cody.stevens@xxxxxxxxxxxx>wrote:

>  Hi All,  not sure of the best way to submit a minor change like this but
> I was having some issues  with Graphite not being able to find and open my
> database that I was able to fix with a minor code change.****
>
> ** **
>
> Our installation uses a number of custom directories that are not the
> default for the graphite installation.   I was using the local_settings.py
> file to set all of the custom directories etc. but the locations of the
> WHISPER_DIR and RRD_DIR.  Were not updating correctly.  I looked at the
> settings.py file and can see that these are initialized depending on whether
> rrdtool imports successfully or not. ****
>
> ** **
>
> Moving the following code to run after importing  the local_settings fixed
> it for me. ****
>
> try:****
>
>   import rrdtool****
>
>   DATA_DIRS = [WHISPER_DIR, RRD_DIR]****
>
> except:****
>
>   DATA_DIRS = [WHISPER_DIR]****
>
> ** **
>
> ** **
>
> ** **
>
> It looks like nothing of but variable initialization occurs prior to this
> code so changing it to import rrdtool after getting my custom settings fixes
> the issue.  ****
>
> ** **
>
> #Pull in overrides from local_settings.py****
>
> try:****
>
>   from graphite.local_settings import *****
>
> except ImportError:****
>
>   print >> sys.stderr, "Could not import graphite.local_settings, using
> defaults!"****
>
> ** **
>
> try:****
>
>   import rrdtool****
>
>   DATA_DIRS = [WHISPER_DIR, RRD_DIR]****
>
> except:****
>
>   DATA_DIRS = [WHISPER_DIR]****
>
> ** **
>
> ** **
>
> Thanks for an  awesome tool!  Hopefully, I am not spamming you.****
>
> ** **
>
> Cody Stevens****
>
> RightNow Technologies****
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> ** **
>
> _______________________________________________
> Mailing list: https://launchpad.net/~graphite-dev
> Post to     : graphite-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~graphite-dev
> More help   : https://help.launchpad.net/ListHelp
>
>

References