Merge "Issue #1735 Performance improvments for LLWSData." into development

Former-commit-id: 5ee7c58ea1f95b89bf252edbee02d0560eaa98aa
This commit is contained in:
Nate Jensen 2013-03-26 16:28:38 -05:00 committed by Gerrit Code Review
commit b44db0bc2c
5 changed files with 53 additions and 22 deletions

View file

@ -538,8 +538,14 @@ def _retrieveMapData(siteIDs, timeSeconds, parameters=Parameters):
for p in parameters: for p in parameters:
task.addParameter(p) task.addParameter(p)
pdcs = GuidanceUtil.getGFEPointsData(task) pdcs = GuidanceUtil.getGFEPointsData(task)
i = 0
results = {} results = {}
if pdcs is None :
for siteId in siteIDs:
_Logger.info('Data not available for %s', siteID)
results[siteID] = None
return results
i = 0
for siteID in siteIDs: for siteID in siteIDs:
pdc = pdcs.getContainer(i) pdc = pdcs.getContainer(i)
if i < pdcs.getSize() : if i < pdcs.getSize() :

View file

@ -133,7 +133,7 @@
#* Date Ticket# Engineer Description #* Date Ticket# Engineer Description
#* ------------ ---------- ----------- -------------------------- #* ------------ ---------- ----------- --------------------------
#* Initial creation. #* Initial creation.
#* Mar 07, 2013 1735 rferrel Use SiteGridManger to limit calls to server. #* Mar 07, 2013 1735 rferrel Use SiteGridManager to limit calls to server.
## ##
import logging, time, cPickle import logging, time, cPickle

View file

@ -48,6 +48,16 @@
# Title: AvnFPS: Incorrect file permission on ISH files # Title: AvnFPS: Incorrect file permission on ISH files
# #
# #
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 25, 2013 1735 rferrel Retrieve only the last 24 hours of acars records.
##
from com.raytheon.viz.aviation.monitor import LlwsManager from com.raytheon.viz.aviation.monitor import LlwsManager
import logging, os, time import logging, os, time
@ -96,12 +106,17 @@ def retrieve(siteID, info):
profilerIds = th.processProfilerData(siteID) profilerIds = th.processProfilerData(siteID)
for profilerId in profilerIds: for profilerId in profilerIds:
try : try :
shear = th.genShear(siteID, profilerId) shear = th.genShear(siteID, profilerId)
d[profilerId] = shear d[profilerId] = shear
except LLWSThread.InValid: except LLWSThread.InValid:
pass pass
acarsRec = LlwsManager.getAcarsRecord(siteID, 0) # This gets all acarsRec in the database since 0 retrieves from the epoch.
# This may be ok if database is purged frequently.
# How far back should it go 1, 6, 12, 24 hours?
# acarsRec = LlwsManager.getAcarsRecord(siteID, 0)
refTime = long((time.time() - (24.0*3600.0)) * 1000.0)
acarsRec = LlwsManager.getAcarsRecord(siteID, refTime)
if acarsRec: if acarsRec:
acarsId = siteID[1:] acarsId = siteID[1:]
th.processAcarsData(acarsId,acarsRec) th.processAcarsData(acarsId,acarsRec)
@ -111,7 +126,7 @@ def retrieve(siteID, info):
except LLWSThread.InValid: except LLWSThread.InValid:
pass pass
else: else:
_Logger.info('Missing ACARS Sounding data for %s.', siteID) _Logger.info('Missing ACARS Sounding data for %s.', siteID)
radars = info['sites']['radars'] radars = info['sites']['radars']
for radar in radars: for radar in radars:
vwp = LlwsManager.getVerticalWindProfile(radar, 0) vwp = LlwsManager.getVerticalWindProfile(radar, 0)

View file

@ -159,6 +159,17 @@
# Status: CLOSED # Status: CLOSED
# Title: AvnFPS: AvnFPS regression based lightning forecast to use LAMP # Title: AvnFPS: AvnFPS regression based lightning forecast to use LAMP
# #
#**
#*
#*
#* <pre>
#* SOFTWARE HISTORY
#* Date Ticket# Engineer Description
#* ------------ ---------- ----------- --------------------------
#* Initial creation.
#* Mar 25, 2013 1735 rferrel __initializeLLWSDictsLists now reads cfg data only for
#* desired site instead of all sites. So it is O(n) instead of O(n**2)
##
# #
import logging, os, Queue, re, time, math, sys import logging, os, Queue, re, time, math, sys
import Avn, AvnParser, LLWSData, MetarData import Avn, AvnParser, LLWSData, MetarData
@ -184,7 +195,6 @@ class Server(object):
__TimeOut = 10.0 __TimeOut = 10.0
def __init__(self, info): def __init__(self, info):
#self.name = info['name']
self.profilerList = [] self.profilerList = []
self.radarList = [] self.radarList = []
self.metarList = [] self.metarList = []
@ -207,7 +217,8 @@ class Server(object):
rList = [] rList = []
aList = [] aList = []
for m in AvnParser.getTafHeaders(): m = info['ident']
if m is not None:
siteDict = AvnParser.getTafSiteCfg(m) siteDict = AvnParser.getTafSiteCfg(m)
try: try:
radars = siteDict['sites']['radars'] radars = siteDict['sites']['radars']
@ -226,17 +237,16 @@ class Server(object):
except KeyError: except KeyError:
acars = [] acars = []
if profilers == [] and radars == [] and acars == []: if len(profilers) > 0 or len(radars) > 0 or len(acars) > 0 :
continue #
# # This TAF site needs to be monitored
# This TAF site needs to be monitored self.metarList.append(m)
self.metarList.append(m) self.siteVWPsDict[m] = [radars,profilers,radar_cutoff,profiler_cutoff]
self.siteVWPsDict[m] = [radars,profilers,radar_cutoff,profiler_cutoff] self.acarsDict[m] = [acars]
self.acarsDict[m] = [acars] #
# pList.extend(profilers)
pList.extend(profilers) rList.extend(radars)
rList.extend(radars) aList.extend(acars)
aList.extend(acars)
# #
# Find all unique radars and profilers to monitor # Find all unique radars and profilers to monitor
self.profilerList = dict.fromkeys(pList).keys() self.profilerList = dict.fromkeys(pList).keys()

View file

@ -101,7 +101,7 @@ import com.raytheon.viz.avnconfig.IStatusSettable;
*/ */
public class TafSiteComp { public class TafSiteComp {
/** /**
* * Grid monitor class name.
*/ */
public static final String GRID_MONITOR_CLASS = "GridMonitor"; public static final String GRID_MONITOR_CLASS = "GridMonitor";