your right, i probably should seperate the hits better. <br>the module that contains my make_history function i did not want to have to create a store<br>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.
<br>def do_some_thing_with_object( obj ):<br> store = Store.of(obj) <br><br>this allows me to use the store that was created in the main thread.<br><br>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.
<br><br>that kinda still wouldn't explain why raw is the only one that does not get updated.<br><br>but i am still new to a lot of this. <br><br>thanks<br><br>shawn<br><br> <br><br><br><div><span class="gmail_quote">
On 8/7/07, <b class="gmail_sendername">Adrian Klaver</b> <<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tuesday 07 August 2007 4:00 pm, shawn bright wrote:<br>> ok, here is my new function:<br>> def make_history(obj, function, s_time = 'none', sid='none',<br>> switch='none'): print '\n\n make history'
<br>> print 'found object %s' % obj.monitor<br>> print 'found raw = %s' % obj.last_raw<br>> print 'type of raw = %s' % type(obj.last_raw)<br>> print 'found value = %s ' %
obj.last_value<br>> store = Store.of(obj)<br>> raw = float(obj.last_raw)<br>> hit = HistoryHit()<br>> hit.monitor = obj.monitor<br>> hit.raw = raw<br>> hit.value = unicode(obj.last_value
)<br>> hit.function = unicode(function)<br>> if s_time == 'none': hit.s_date_time = datetime.datetime.now()<br>> hit.date_time = datetime.datetime.now()<br>> hit.sid, hit.switch = unicode(sid), unicode(switch)
<br>> store.add(hit)<br>><br>> the print statments show me that in my test, the raw was a type float<br>> before the line that makes it one.<br>> but i left the line that makes it a float in there anyway.
<br>> raw = float(hit.raw)<br>Alright, I am now officially lost. Where did this line come from? I see raw =<br>float(obj.last_raw) but not raw = float(hit.raw).<br>> then later<br>> hit.raw = raw<br>><br>> but still, the only thing showing up in the history table is 0 ( the
<br>> default )<br>> and the DEBUG of the sql statement is still missing the raw as part of what<br>> gets<br>> INSERT INTO history..<br>><br>> thanks<br>> shawn<br>><br>I am still working out the semantics of storm so I am not sure what store =
<br>Store.of(obj) does and how that affects the store.add(hit) call later. If it<br>where me I would try store=Store(). Also we are not seeing all the code and<br>in your examples you call self.store before running make_history so it is
<br>entirely possible you need to drop the store assignment and just do<br>self.store.add(hit). Something else comes to mind, in your examples you<br>assign to hit for values going to StatusHit() and for values going to<br>
HistoryHit(). Having wrestled with name visibility before, I generally try to<br>create different names to make it easier to sort out where my values are<br>originating from i.e. status_hit,history_hit<br><br><br>Good luck,
<br>--<br>Adrian Klaver<br><a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a><br></blockquote></div><br>