Issue #2063: Improve performance of grid blanking in iscMosaic by only retrieving history data, not entire grid slices.

Change-Id: Icd25e7e54a391ca19445be866e411b35aed54b16

Former-commit-id: 5e53c3f0bd [formerly 51b317ac52] [formerly 9acf385f21] [formerly bad6a1fa40 [formerly 9acf385f21 [formerly 5570ee749c5797f8f2c9ab3f6f8392d2c5680d32]]]
Former-commit-id: bad6a1fa40
Former-commit-id: 71dde9577d001c57231eb1ddf6cca6a71e302a55 [formerly 070365714a]
Former-commit-id: 5fe4739fc4
This commit is contained in:
David Gillingham 2013-06-05 16:07:28 -05:00
parent 3e28a3a2c2
commit 8ade43a3dc
2 changed files with 44 additions and 6 deletions

View file

@ -26,6 +26,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TimeZone;
@ -81,6 +82,7 @@ import com.raytheon.uf.common.time.TimeRange;
* Apr 23, 2013 #1941 dgilling Implement put(), add methods to build
* Scalar/VectorGridSlices, refactor
* Discrete/WeatherGridSlices builders.
* Jun 05, 2013 #2063 dgilling Port history() from A1.
*
* </pre>
*
@ -308,6 +310,39 @@ public class IFPWE {
}
}
/**
* Returns the grid history for a specified time range.
*
* @param tr
* The time for which the history is being requested.
* @return The grid history entries for the specified time range in coded
* string format.
*/
public List<String> history(final TimeRange tr) {
ServerResponse<Map<TimeRange, List<GridDataHistory>>> sr = GridParmManager
.getGridHistory(parmId, Arrays.asList(tr));
if (!sr.isOkay()) {
statusHandler.error("Error retrieving grid history for parm ["
+ parmId + "] at time range " + tr + ": " + sr.message());
return Collections.emptyList();
}
Map<TimeRange, List<GridDataHistory>> payload = sr.getPayload();
if ((payload == null) || (payload.isEmpty())) {
statusHandler.error("No grid history returned for parm [" + parmId
+ "] at time range " + tr);
return Collections.emptyList();
}
List<GridDataHistory> hist = payload.get(tr);
List<String> retVal = new ArrayList<String>(hist.size());
for (GridDataHistory entry : hist) {
retVal.add(entry.getCodedString());
}
return retVal;
}
private void setItem(TimeRange time, IGridSlice gridSlice,
List<GridDataHistory> gdh) throws GfeException {
GFERecord rec = new GFERecord(parmId, time);

View file

@ -80,6 +80,8 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask
# 05/08/13 1988 dgilling Fix history handling bug in
# __getDbGrid().
# 05/23/13 1759 dgilling Remove unnecessary imports.
# 06/05/13 2063 dgilling Change __siteInDbGrid() to
# call IFPWE.history() like A1.
#
#
@ -1289,13 +1291,14 @@ class IscMosaic:
def __siteInDbGrid(self, tr):
if tr is None:
return None
history = self.__dbwe.getItem(iscUtil.toJavaTimeRange(tr)).getHistory()
history = self.__dbwe.history(iscUtil.toJavaTimeRange(tr))
for i in range(0, len(history)):
index = string.find(history[i].getCodedString(), self.__siteID + "_GRID")
if index != -1:
return 1
return 0
itr = history.iterator()
while itr.hasNext():
h = str(itr.next())
if self.__siteID + "_GRID" in h:
return True
return False
#---------------------------------------------------------------------
# validateAdjustDiscreteKeys()