your right, i probably should seperate the hits better. the module that contains my make_history function i did not want to have to create a store for each time one of the functions operated, so i use the store of the object that i pass into it from my main thread. def do_some_thing_with_object( obj ): store = Store.of(obj)
this allows me to use the store that was created in the main thread. i will try again with renamed variables. Maybe the values are not maintained well because of the way i have them. Since the same store had a hit in it that represented a StatusHit and one that represented a HistoryHit. that kinda still wouldn't explain why raw is the only one that does not get updated. but i am still new to a lot of this. thanks shawn On 8/7/07, Adrian Klaver <[EMAIL PROTECTED]> wrote: > > On Tuesday 07 August 2007 4:00 pm, shawn bright wrote: > > ok, here is my new function: > > def make_history(obj, function, s_time = 'none', sid='none', > > switch='none'): print '\n\n make history' > > print 'found object %s' % obj.monitor > > print 'found raw = %s' % obj.last_raw > > print 'type of raw = %s' % type(obj.last_raw) > > print 'found value = %s ' % obj.last_value > > store = Store.of(obj) > > raw = float(obj.last_raw) > > hit = HistoryHit() > > hit.monitor = obj.monitor > > hit.raw = raw > > hit.value = unicode(obj.last_value) > > hit.function = unicode(function) > > if s_time == 'none': hit.s_date_time = datetime.datetime.now() > > hit.date_time = datetime.datetime.now() > > hit.sid, hit.switch = unicode(sid), unicode(switch) > > store.add(hit) > > > > the print statments show me that in my test, the raw was a type float > > before the line that makes it one. > > but i left the line that makes it a float in there anyway. > > raw = float(hit.raw) > Alright, I am now officially lost. Where did this line come from? I see > raw = > float(obj.last_raw) but not raw = float(hit.raw). > > then later > > hit.raw = raw > > > > but still, the only thing showing up in the history table is 0 ( the > > default ) > > and the DEBUG of the sql statement is still missing the raw as part of > what > > gets > > INSERT INTO history.. > > > > thanks > > shawn > > > I am still working out the semantics of storm so I am not sure what store > = > Store.of(obj) does and how that affects the store.add(hit) call later. If > it > where me I would try store=Store(). Also we are not seeing all the code > and > in your examples you call self.store before running make_history so it is > entirely possible you need to drop the store assignment and just do > self.store.add(hit). Something else comes to mind, in your examples you > assign to hit for values going to StatusHit() and for values going to > HistoryHit(). Having wrestled with name visibility before, I generally try > to > create different names to make it easier to sort out where my values are > originating from i.e. status_hit,history_hit > > > Good luck, > -- > Adrian Klaver > [EMAIL PROTECTED] >
-- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
