On Monday, 26 June 2017 10:35:35 UTC+10, Tom Keffer wrote:
>
> Say you have two SLEs. The first one defines foo, the second bar. 
> Furthermore, say we have a template containing
>
> $bar.outTemp
> $bar.barometer
> $bar.whiz
>
> As Cheetah evaluates these, it will try the "foo" extension first (because 
> it's first in the list). But, because foo doesn't define bar, it moves on 
> to the next extension in the list. The "bar" extension does define it, so 
> it gets a hit. Cheetah then tries to evaluate the attributes 'outTemp', 
> 'barometer', 'whiz' on the results.
>

Agreed, I think whether the database is hit or not depends on what the SLE 
is returning. If it is returning a complex calculated result as say a 
ValueTuple, then the database access was all done during the SLE execution, 
whereas if it is returning some sort of timespan binder (maybe not the 
technically correct term but I hope you know what I mean) the database hit 
occurs after as requried.
 

> So, the foo extension did get probed, but not far enough to do the full 
> evaluation. Because the standard weewx extensions use lazy evaluation, that 
> means the database never actually gets queried.
>
> I'm not sure I'm being very clear here and I'm not sure I addressed your 
> point. If not, and I'm missing something, I'd sure like to know!
>

Perhaps if I explain my observations (non-weather!) it might help.

I have a SLE that returns some data, it does not matter what the data is. 
Immediately before the return statement at the end of the SLE 
get_extension_list() method, I have a debug syslog statement that logs the 
execution time of the SLE. I have a skin that includes four reports, in the 
skin the search_list_extension option includes the SLE just mentioned. Only 
one of the reports uses the result returned by the SLE. When I run weeWX 
with debug=1 I see four syslog entries with execution times for the SLE. 
This tells me the SLE get_extension_list() method was called four times. 

Whether or not the database was hit really depends on the SLE, but the SLE 
get_extension_list() method is executed once for each report.

Gary

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to