Issue #1597 Code cleanup and logging improvement for GFE Performance metrics

Change-Id: Ib4d92b3c5a270e28a75beb5fbb5cf56557165765

Former-commit-id: f37999b1eb [formerly bfe3c684df [formerly 0b4b49014598aeb94492d0b713afe17732c6e029]]
Former-commit-id: bfe3c684df
Former-commit-id: d43afc8c67
This commit is contained in:
Ron Anderson 2013-02-20 17:29:38 -06:00
parent 0cd78444b8
commit 547f0d086f
28 changed files with 567 additions and 197 deletions

View file

@ -88,11 +88,17 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile,
site = str(site)
databaseID = str(databaseID)
username = str(username)
logger.info("TextFormatter Starting")
startTime = time.time()
logger.info("Text Formatter Starting")
forecasts = runFormatter(databaseID=databaseID, site=site, forecastList=forecastList, testMode=testMode,
cmdLineVarDict=cmdLineVarDict, vtecMode=vtecMode, username=username,
dataMgr=dataMgr, drtTime=drtTime)
elapsedTime = (time.time() - startTime)*1000
logger.info("Text Formatter Finished, took: %d ms",elapsedTime)
RedirectLogging.restore()
return forecasts
@ -286,7 +292,6 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode,
# This also means that you may not import any new modules after this
# point!!!!!!!!!!!!!!!
logger.info("Text Formatter Finished")
return forecasts
def getAbsTime(timeStr):

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG" />
<param name="levelMax" value="INFO" />
</filter>
</appender>
<appender name="errConsole" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<param name="Threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<logger name="CaveLogger">
<level value="ALL"/>
</logger>
<logger name="PerformanceLogger">
<level value="ALL"/>
</logger>
<logger name="com.raytheon">
<level value="INFO"/>
</logger>
<logger name="com.tc">
<level value="WARN"/>
</logger>
<logger name="mx4j">
<level value="ERROR"/>
</logger>
<logger name="org.apache">
<level value="INFO"/>
</logger>
<logger name="org.apache.activemq.spring">
<level value="WARN"/>
</logger>
<logger name="org.apache.commons.beanutils">
<level value="WARN"/>
</logger>
<logger name="org.apache.qpid">
<level value="WARN"/>
</logger>
<logger name="org.geotools">
<level value="WARN"/>
</logger>
<logger name="org.apache.xbean.spring">
<level value="WARN"/>
</logger>
<logger name="org.springframework">
<level value="ERROR"/>
</logger>
<logger name="uk.ltd.getahead">
<level value="WARN"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
<appender-ref ref="errConsole"/>
</root>
</log4j:configuration>

View file

@ -43,15 +43,17 @@
<param name="BufferSize" value="500"/>
<appender-ref ref="CaveLogAppender"/>
</appender>
<logger name="CaveLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncCaveLogAppender"/>
</logger>
<appender name="AsyncPerfLogAppender" class="org.apache.log4j.AsyncAppender">
<param name="BufferSize" value="500"/>
<appender-ref ref="PerformanceLogAppender"/>
</appender>
<logger name="CaveLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncCaveLogAppender"/>
</logger>
<logger name="PerformanceLogger" additivity="false">
<level value="ALL"/>
<appender-ref ref="AsyncPerfLogAppender"/>

View file

@ -29,7 +29,9 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.services.IDisposable;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.Activator;
@ -58,6 +60,9 @@ public class TimeMatchingJob extends Job {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeMatchingJob.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("Core:");
static {
Activator.getDefault().registerDisposable(new IDisposable() {
@Override
@ -121,8 +126,8 @@ public class TimeMatchingJob extends Job {
long t0 = System.currentTimeMillis();
request.getTimeMatcher().redoTimeMatching(request);
long time = (System.currentTimeMillis() - t0);
if (time > 0) {
System.out.println("time matching took: " + time + "ms");
if (time > 10) {
perfLog.logDuration("time matching", time);
}
if (!this.keepAround) {
map.remove(request);

View file

@ -0,0 +1,17 @@
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<bean id="gfeClientConfig" class="com.raytheon.viz.gfe.core.GfeClientConfig" factory-method="getInstance">
<property name="maxSaveThreads" value="3"/>
<property name="gridSaveThreshold" value="33554432"/>
<!-- threshold = 32*1024*1024 bytes (32 MB)-->
</bean>
</beans>

View file

@ -173,10 +173,10 @@ public abstract class BaseGfePyController extends PythonScriptController {
public void garbageCollect() {
try {
jep.eval("import gc");
jep.eval("gc.collect()");
jep.eval("gcResult = gc.collect()");
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error garbage collecting GFE python interpreter", e);
}
}
}
}

View file

@ -24,7 +24,12 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.IParmManager;
import com.raytheon.viz.gfe.core.IWEGroupManager;
@ -37,7 +42,8 @@ import com.raytheon.viz.gfe.core.IWEGroupManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 9, 2008 chammack Initial creation
* Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager.
* Apr 9, 2009 #1288 rjpeter Removed explicit refresh of SpatialDisplayManager.
* Feb 12, 2013 #1597 randerso Code cleanup and logging for GFE performance metrics
* </pre>
*
* @author chammack
@ -45,25 +51,32 @@ import com.raytheon.viz.gfe.core.IWEGroupManager;
*/
public class LoadWEGroup extends AbstractHandler {
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ITimer timer = TimeUtil.getTimer();
timer.start();
String name = event.getParameter("name");
if (name == null)
if (name == null) {
return null;
}
IWEGroupManager weGroupMgr = DataManager.getCurrentInstance()
.getWEGroupManager();
DataManager dm = DataManagerUIFactory.getCurrentInstance();
IWEGroupManager weGroupMgr = dm.getWEGroupManager();
IParmManager parmMgr = dm.getParmManager();
IParmManager parmMgr = DataManager.getCurrentInstance()
.getParmManager();
ParmID[] parms = parmMgr.getAllAvailableParms();
ParmID[] pidsToLoad = weGroupMgr.getParmIDs(name, parms);
parmMgr.setDisplayedParms(pidsToLoad);
timer.stop();
perfLog.logDuration("Load WE Group " + name, timer.getElapsedTime());
return null;
}
}

View file

@ -0,0 +1,80 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.gfe.core;
/**
* Class to hold GFE client configuration settings. Actual settings are in
* com.raytheon.viz.gfe/res/spring/gfe.xml
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 28, 2013 randerso Initial creation
*
* </pre>
*
* @author randerso
* @version 1.0
*/
public class GfeClientConfig {
private int maxSaveThreads;
private long gridSaveThreshold;
private static final GfeClientConfig instance = new GfeClientConfig();
public static GfeClientConfig getInstance() {
return instance;
}
private GfeClientConfig() {
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("GfeClientConfig:");
sb.append("\n maxSaveThreads: ").append(maxSaveThreads);
sb.append("\n gridSaveThreshold: ").append(gridSaveThreshold);
return sb.toString();
}
public int getMaxSaveThreads() {
return maxSaveThreads;
}
public void setMaxSaveThreads(int maxSaveThreads) {
this.maxSaveThreads = maxSaveThreads;
}
public long getGridSaveThreshold() {
return gridSaveThreshold;
}
public void setGridSaveThreshold(long gridSaveThreshold) {
this.gridSaveThreshold = gridSaveThreshold;
}
}

View file

@ -106,7 +106,8 @@ import com.vividsolutions.jts.geom.Envelope;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 1, 2008 #1053 randerso Initial creation
* 2/14/2013 #1506 mnash Move QueryScript to use new Python concurrency implementation
* 02/14/2013 #1506 mnash Move QueryScript to use new Python concurrency implementation
* 02/12/2013 #1597 randerso Improved error message for exceptions evaluating queries
*
* </pre>
*
@ -1787,7 +1788,8 @@ public class ReferenceSetManager implements IReferenceSetManager,
}
} catch (JepException e) {
statusHandler.handle(Priority.PROBLEM,
"Error evaluating query", e);
"Error evaluating query \"" + active.getQuery()
+ "\" for " + active.getId().getName(), e);
}
}
@ -1810,6 +1812,7 @@ public class ReferenceSetManager implements IReferenceSetManager,
"Unable to finish QueryScript job", e);
}
@Override
public void jobFinished(ReferenceData result) {
getActiveRefSet();
if (!result.getGrid().equals(getActiveRefSet().getGrid())) {

View file

@ -33,6 +33,7 @@ import org.eclipse.core.runtime.Status;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
@ -50,14 +51,19 @@ import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.slice.VectorGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.slice.WeatherGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.weather.WeatherKey;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.GFEOperationFailedException;
import com.raytheon.viz.gfe.GFEServerException;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.GfeClientConfig;
import com.raytheon.viz.gfe.core.griddata.AbstractGridData;
import com.raytheon.viz.gfe.core.griddata.IGridData;
@ -74,6 +80,8 @@ import com.raytheon.viz.gfe.core.griddata.IGridData;
* 02/23/12 #346 dgilling Implement a dispose method.
* 03/01/12 #346 dgilling Re-order dispose method.
* 01/21/12 #1504 randerso Cleaned up old debug logging to improve performance
* 02/12/13 #1597 randerso Made save threshold a configurable value. Added detailed
* logging for save performance
*
* </pre>
*
@ -85,8 +93,8 @@ public class DbParm extends Parm {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DbParm.class);
// save if we accumulate more than 16 MB
private static final long MAX_SAVE_SIZE = 16 * 1024 * 1024;
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
public DbParm(ParmID parmID, GridParmInfo gridInfo, boolean mutable,
boolean displayable, DataManager dataMgr) throws GFEServerException {
@ -475,6 +483,8 @@ public class DbParm extends Parm {
return true;
}
ITimer timer = TimeUtil.getTimer();
timer.start();
ServerResponse<List<LockTable>> sr;
try {
sr = this.dataManager.getClient().requestLockChange(lreq);
@ -483,7 +493,12 @@ public class DbParm extends Parm {
"Error requesting lock change", e);
return false;
}
timer.stop();
perfLog.logDuration("Server lock change for " + this.getParmID() + " "
+ lreq.size() + " time rangess", timer.getElapsedTime());
timer.reset();
timer.start();
List<LockTable> lockTableList = sr.getPayload();
for (LockTable lt : lockTableList) {
// it is for our parm
@ -499,6 +514,8 @@ public class DbParm extends Parm {
}
}
}
timer.stop();
perfLog.logDuration("Processing lock tables", timer.getElapsedTime());
for (ServerMsg msg : sr.getMessages()) {
statusHandler.error(msg.getMessage());
}
@ -509,23 +526,24 @@ public class DbParm extends Parm {
@Override
protected boolean saveParameterSubClass(List<TimeRange> trs) {
ITimer timer = TimeUtil.getTimer();
timer.start();
List<TimeRange> myLocks = lockTable.lockedByMe();
if (myLocks.isEmpty()) {
timer.stop();
perfLog.logDuration("Saving " + getParmID().getParmName() + ": "
+ " no grids to save ", timer.getElapsedTime());
return true;
}
// FIXME: Purge functionality
purgeUndoGrids();
// assemble the save grid request and lock requests
// List<IGridData> gridsSaved = new ArrayList<IGridData>();
List<SaveGridRequest> sgr = new ArrayList<SaveGridRequest>();
List<LockRequest> lreq = new ArrayList<LockRequest>();
List<TimeRange> pendingUnlocks = new ArrayList<TimeRange>();
// compute grid size in bytes
GridLocation gloc = this.getGridInfo().getGridLoc();
GridType gridType = this.getGridInfo().getGridType();
int gridSize = gloc.getNx() * gloc.getNy();
switch (this.getGridInfo().getGridType()) {
switch (gridType) {
case SCALAR:
gridSize *= 4; // 4 bytes per grid cell
break;
@ -538,7 +556,15 @@ public class DbParm extends Parm {
// ignoring size of keys for now
}
// assemble the save grid request and lock requests
List<SaveGridRequest> sgr = new ArrayList<SaveGridRequest>();
List<LockRequest> lreq = new ArrayList<LockRequest>();
List<TimeRange> pendingUnlocks = new ArrayList<TimeRange>();
boolean success = true;
int gridCount = 0;
int totalGrids = 0;
long totalSize = 0;
long size = 0;
for (int i = 0; i < trs.size(); i++) {
// ensure we have a lock for the time period
@ -582,10 +608,10 @@ public class DbParm extends Parm {
record.setGridHistory(data.getHistory());
record.setMessageData(data.getGridSlice());
records.add(record);
gridCount += (gridType.equals(GridType.VECTOR) ? 2 : 1);
size += gridSize;
if (size > MAX_SAVE_SIZE) {
// time range being saved in this chunk
if (size > GfeClientConfig.getInstance().getGridSaveThreshold()) {
TimeRange tr = new TimeRange(saveTime.getStart(), data
.getGridTime().getEnd());
sgr.add(new SaveGridRequest(getParmID(), tr, records,
@ -602,8 +628,12 @@ public class DbParm extends Parm {
allSaved = false;
}
totalGrids += gridCount;
totalSize += size;
pendingUnlocks.clear();
sgr.clear();
gridCount = 0;
records.clear();
size = 0;
saveTime.setStart(tr.getEnd());
@ -633,6 +663,9 @@ public class DbParm extends Parm {
} else {
success = false;
}
totalSize += size;
totalGrids += gridCount;
pendingUnlocks.clear();
}
@ -650,6 +683,11 @@ public class DbParm extends Parm {
purgeUndoGrids();
}
timer.stop();
perfLog.logDuration("Save Grids " + getParmID().getParmName() + ": "
+ totalGrids + " grids (" + totalSize + " bytes) ",
timer.getElapsedTime());
return success;
}

View file

@ -176,6 +176,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 03/02/2012 #346 dgilling Create a disposed flag to help ensure
* no interaction with Parms after dispose
* is called.
* 02/13/13 #1597 randerso Removed debug logging to improve performance
* </pre>
*
* @author chammack
@ -293,11 +294,7 @@ public abstract class Parm implements Comparable<Parm> {
if (req != null) {
this.setName("Interpolating "
+ req.parm.getParmID().getParmName() + "...");
System.out.println("Starting interpolatation for "
+ req.parm + " on job " + this);
req.parm.doInterpolation(false);
System.out.println("Finished interpolatation for "
+ req.parm + " on job " + this);
this.schedule();
}
return Status.OK_STATUS;
@ -1969,10 +1966,10 @@ public abstract class Parm implements Comparable<Parm> {
for (i = 0; i < this.undoBuffers.size(); i++) {
UndoBuffer undoBuffer = this.undoBuffers.get(i);
String msg = "Undoing " + getParmID() + " tr="
+ undoBuffer.getUndoTimeRange();
statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
+ msg));
// String msg = "Undoing " + getParmID() + " tr="
// + undoBuffer.getUndoTimeRange();
// statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
// + msg));
baffectedTR[i] = undoBuffer.getUndoTimeRange();
bgridCopies[i] = new ArrayList<IGridData>();
@ -4287,23 +4284,6 @@ public abstract class Parm implements Comparable<Parm> {
// We will do the real work in a job for ASYNC mode
else {
InterpolateJob.request(this);
// Job job = new Job("Interpolating...") {
//
// @Override
// protected IStatus run(IProgressMonitor monitor) {
// try {
// doInterpolation(false);
// return Status.OK_STATUS;
// } catch (GFEOperationFailedException e) {
// return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
// "Interpolation failed", e);
// }
// }
//
// };
// job.setSystem(false);
// job.schedule();
}
return true;
}

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
* 06/24/2009 1876 njensen Publish updates inventory
* 02/23/2012 1876 dgilling Implement missing clearUndoParmList
* function.
* 02/13/2013 #1597 randerso Added logging to support GFE Performance metrics
*
* </pre>
*
@ -386,6 +387,7 @@ public class ParmOp {
*/
public void interpolateSelected(InterpMode interpMode,
InterpState interpState, int interval, int duration) {
statusHandler.debug("Interpolation started");
Parm[] allParms = this.dataManager.getParmManager().getAllParms();
for (Parm parm : allParms) {
if (parm.getParmState().isSelected() && parm.isMutable()) {

View file

@ -40,11 +40,16 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.GfeClientConfig;
import com.raytheon.viz.gfe.core.parm.Parm;
import com.raytheon.viz.gfe.ui.HazardUIUtils;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
@ -60,6 +65,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* Oct 26, 2011 randerso Initial creation
* Oct 30, 2012 1298 rferrel Code clean for non-blocking dialog.
* 02/13/2013 #1597 randerso Made number of concurrent save threads a configurable value.
* Added logging to support GFE Performance metrics
*
* </pre>
*
@ -72,7 +79,8 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractSaveParameterDialog.class);
private final int MAX_CONCURRENT_SAVES = 5;
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
protected DataManager dataManager;
@ -88,6 +96,8 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
protected Font font;
private ITimer saveTimer;
protected AbstractSaveParameterDialog(Shell parentShell,
DataManager dataManager) {
super(parentShell);
@ -101,7 +111,7 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
// see if Hazards WE is modified and if so save it
this.hazParm = HazardUIUtils.hazardsWEModified(this.dataManager);
this.hazardsModified = this.hazParm != null;
this.saveTimer = TimeUtil.getTimer();
}
/*
@ -145,6 +155,8 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
* Callback for saving the parameters
*/
protected void saveParms(List<Parm> parmsToSave) {
saveTimer.reset();
saveTimer.start();
this.getShell().setEnabled(false);
final Cursor origCursor = this.getShell().getCursor();
this.getShell().setCursor(
@ -158,14 +170,14 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
@Override
protected IStatus run(IProgressMonitor monitor) {
long t0 = System.currentTimeMillis();
final AtomicBoolean allSuccessful = new AtomicBoolean(true);
try {
final CountDownLatch latch = new CountDownLatch(
MAX_CONCURRENT_SAVES);
GfeClientConfig cfg = GfeClientConfig.getInstance();
int saveThreads = cfg.getMaxSaveThreads();
final CountDownLatch latch = new CountDownLatch(saveThreads);
// spawn separate jobs top save parms
for (int i = 0; i < MAX_CONCURRENT_SAVES; i++) {
for (int i = 0; i < saveThreads; i++) {
new Job("Saving Parms") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@ -176,12 +188,6 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
.toString();
try {
// save data
if (statusHandler
.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(
Priority.DEBUG,
"Save: " + parmString);
}
if (!parm.saveParameter(true)) {
allSuccessful.set(false);
}
@ -216,8 +222,6 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
statusHandler
.handle(Priority.PROBLEM,
"Some grids were not saved. See log for details.");
} else {
statusHandler.handle(Priority.DEBUG, "Save Complete");
}
VizApp.runAsync(new Runnable() {
@ -230,10 +234,6 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
.saveFinished(allSuccessful.get());
}
});
long t1 = System.currentTimeMillis();
System.out.println("GFE Save Forecast took: " + (t1 - t0)
+ " ms");
}
return Status.OK_STATUS;
}
@ -249,6 +249,9 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
} else {
super.cancelPressed();
}
saveTimer.stop();
perfLog.logDuration("Save Forecast", saveTimer.getElapsedTime());
}
}

View file

@ -32,6 +32,10 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.IParmManager;
import com.raytheon.viz.gfe.core.UIFormat;
@ -45,8 +49,9 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 26, 2008 Eric Babin Initial Creation
* Feb 26, 2008 Eric Babin Initial Creation
* Oct 23, 2012 1287 rferrel Made dialog modal like AWIPS 1.
* 02/12/2013 #1597 randerso Adde logging to support GFE Performance metrics
*
* </pre>
*
@ -55,6 +60,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*/
public class CopyGridsDialog extends CaveJFACEDialog {
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
private Composite top;
@ -173,16 +180,19 @@ public class CopyGridsDialog extends CaveJFACEDialog {
}
private void copyGrids() {
ITimer timer = TimeUtil.getTimer();
timer.start();
String s = groupList.getSelection()[0];
DatabaseID model = (DatabaseID) groupList.getData(s);
long t0 = System.currentTimeMillis();
if (isSelected) {
dataManager.getParmOp().copySelectedFrom(model);
} else {
dataManager.getParmOp().copyEverythingFrom(model);
}
System.out.println("copyGrids took "
+ (System.currentTimeMillis() - t0) + " ms");
timer.stop();
perfLog.logDuration("Copy Grids", timer.getElapsedTime());
}
}

View file

@ -69,7 +69,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 7, 2008 Eric Babin Initial Creation
* Mar 7, 2008 Eric Babin Initial Creation
* 02/12/2013 #1597 randerso Modified TaskOutputDialog to support GFE Performance metrics
*
* </pre>
*
@ -445,8 +446,9 @@ public class ProcessMonitorDialog extends CaveJFACEDialog implements
logText.setText(getLogFileContents());
Composite timeComp = new Composite(comp, SWT.NONE);
GridLayout layout = new GridLayout(2, true);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.verticalSpacing = 0;
timeComp.setLayout(layout);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
timeComp.setLayoutData(layoutData);
@ -454,32 +456,61 @@ public class ProcessMonitorDialog extends CaveJFACEDialog implements
SimpleDateFormat sdf = new SimpleDateFormat(
"EEE MMM d HH:mm:ss yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
Text startText = new Text(timeComp, SWT.BORDER | SWT.READ_ONLY
| SWT.WRAP);
Composite startComp = new Composite(timeComp, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.verticalSpacing = 0;
startComp.setLayout(layout);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
startComp.setLayoutData(layoutData);
Label label = new Label(startComp, SWT.NONE);
Date date;
String s;
if (task.getStartedTime() == null) {
s = "Queue Time: ";
label.setText("Queue Time:");
date = task.getQueuedTime();
} else {
s = "Start Time: ";
label.setText("Start Time:");
date = task.getStartedTime();
}
startText.setText(s + sdf.format(date));
layoutData = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
Text startText = new Text(startComp, SWT.BORDER | SWT.READ_ONLY);
startText.setText(sdf.format(date));
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
startText.setLayoutData(layoutData);
Composite elapsedComp = new Composite(timeComp, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.verticalSpacing = 0;
elapsedComp.setLayout(layout);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
elapsedComp.setLayoutData(layoutData);
if (task.getFinishedTime() != null) {
Text endText = new Text(timeComp, SWT.BORDER | SWT.READ_ONLY
| SWT.WRAP);
label = new Label(elapsedComp, SWT.RIGHT);
layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
label.setText("Elapsed:");
label.setLayoutData(layoutData);
long delta = task.getFinishedTime().getTime()
- task.getStartedTime().getTime();
Text elapsedText = new Text(elapsedComp, SWT.BORDER
| SWT.READ_ONLY);
elapsedText.setText(delta + " ms");
layoutData = new GridData(SWT.RIGHT, SWT.DEFAULT, false, false);
elapsedText.setLayoutData(layoutData);
label = new Label(startComp, SWT.NONE);
if (task.getStatus() == TaskStatus.FINISHED) {
s = "End Time: ";
label.setText("End Time:");
} else {
s = "Canceled Time: ";
label.setText("Canceled Time:");
}
s += sdf.format(task.getFinishedTime());
endText.setText(s);
layoutData = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
Text endText = new Text(startComp, SWT.BORDER | SWT.READ_ONLY);
endText.setText(sdf.format(task.getFinishedTime()));
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
endText.setLayoutData(layoutData);
}

View file

@ -50,10 +50,14 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.server.request.CommitGridRequest;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.PythonPreferenceStore;
@ -77,6 +81,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Sep 01, 2009 #1370 randerso Completely reworked
* Aug 05, 2010 6698 mpduff Moved Publish work to its own thread.
* Oct 25, 2012 1287 rferrel Code cleanup for non-blocking dialog.
* 02/12/2013 #1597 randerso Added logging to support GFE Performance metrics
*
* </pre>
*
@ -87,6 +92,9 @@ public class PublishDialog extends CaveJFACEDialog {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PublishDialog.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
private final int MAX_LIST_HEIGHT = 10;
private final PythonPreferenceStore prefs = Activator.getDefault()
@ -412,6 +420,9 @@ public class PublishDialog extends CaveJFACEDialog {
}
private void publishCB() {
final ITimer timer = TimeUtil.getTimer();
timer.start();
final Cursor origCursor = getShell().getCursor();
getShell().setCursor(
getShell().getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
@ -435,8 +446,6 @@ public class PublishDialog extends CaveJFACEDialog {
@Override
protected IStatus run(IProgressMonitor monitor) {
long t0 = System.currentTimeMillis();
try {
// publish the data by calling the dataManager
// publish function
@ -455,12 +464,13 @@ public class PublishDialog extends CaveJFACEDialog {
public void run() {
PublishDialog.this.getShell().setCursor(origCursor);
PublishDialog.super.okPressed();
timer.stop();
perfLog.logDuration("Publish Grids",
timer.getElapsedTime());
}
});
long t1 = System.currentTimeMillis();
System.out.println("GFE Publish took " + (t1 - t0) + " ms");
return Status.OK_STATUS;
}

View file

@ -101,6 +101,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.notification.INotificationObserver;
@ -148,6 +149,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 08 Feb 2013 12851 jzeng Add menuToAddTo in create*Menu
* Create createEditorPopupMenu()
* Add mouselistener in createTextControl() for StyledText
* 02/12/2013 #1597 randerso Code cleanup. Fixed possible widget disposed errors on shut down.
*
* </pre>
*
@ -171,7 +173,7 @@ public class ProductEditorComp extends Composite implements
* Toolbar used to mimic a menu bar.
*/
private ToolBar toolbar;
/**
* Pop-up Menu
*/
@ -515,7 +517,7 @@ public class ProductEditorComp extends Composite implements
transLiveImg = getImageRegistry().get("transmitLive");
checkImg = getImageRegistry().get("checkmark");
menuItems = new ArrayList<MenuItem>();
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
GridLayout gl = new GridLayout(1, false);
gl.marginHeight = 1;
@ -576,7 +578,7 @@ public class ProductEditorComp extends Composite implements
*/
private void createToolbar() {
toolbar = new ToolBar(this, SWT.NONE);
fileMenu = new Menu(parent.getShell(), SWT.POP_UP);
createFileMenu(fileMenu);
editMenu = new Menu(parent.getShell(), SWT.POP_UP);
@ -643,7 +645,7 @@ public class ProductEditorComp extends Composite implements
* Create the file menu.
*/
private void createFileMenu(Menu menuToAddTo) {
MenuItem saveFileMI = new MenuItem(menuToAddTo, SWT.PUSH);
saveFileMI.setText("Save File...");
saveFileMI.addSelectionListener(new SelectionAdapter() {
@ -662,7 +664,7 @@ public class ProductEditorComp extends Composite implements
}
});
menuItems.add(storeMI);
// we can't color the background of the menu item so
// we use an image like the tab folder.
transmitMI = new MenuItem(menuToAddTo, SWT.PUSH);
@ -675,7 +677,7 @@ public class ProductEditorComp extends Composite implements
}
});
menuItems.add(transmitMI);
// Menu Separator
new MenuItem(menuToAddTo, SWT.SEPARATOR);
@ -757,7 +759,7 @@ public class ProductEditorComp extends Composite implements
* Create the edit menu.
*/
private void createEditMenu(Menu menuToAddTo) {
MenuItem undoMI = new MenuItem(menuToAddTo, SWT.PUSH);
undoMI.setText("Undo");
undoMI.setEnabled(false);
@ -944,14 +946,14 @@ public class ProductEditorComp extends Composite implements
textComp.setAutoWrapMode(wrapMode);
createEditorPopupMenu();
textComp.getTextEditorST().addMouseListener(new MouseAdapter(){
@Override
public void mouseDown(MouseEvent e) {
if (e.button == 3){
popupMenu.setVisible(true);
}
}
textComp.getTextEditorST().addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
if (e.button == 3) {
popupMenu.setVisible(true);
}
}
});
}
@ -1572,7 +1574,8 @@ public class ProductEditorComp extends Composite implements
// check the ending time and transmission time
if ((action.equals("EXP") || action.equals("CAN"))
&& vtecEnd != null) {
vtecEnd.setTime(vtecEnd.getTime() + 30 * 60 * 1000);
vtecEnd.setTime(vtecEnd.getTime() + 30
* TimeUtil.MILLIS_PER_MINUTE);
}
if (vtecEnd != null
@ -1904,7 +1907,8 @@ public class ProductEditorComp extends Composite implements
}
// seconds
long offset = (maxPurgeTime - pitTime.getTime()) / 1000L;
long offset = (maxPurgeTime - pitTime.getTime())
/ TimeUtil.MILLIS_PER_SECOND;
// Round up to nearest 15 minutes
long extra = offset % 900;
@ -1913,7 +1917,7 @@ public class ProductEditorComp extends Composite implements
}
// convert to hours and check bounds
Float purgeOffset = offset / 3600.0F;
Float purgeOffset = (float) (offset / TimeUtil.SECONDS_PER_HOUR);
purgeOffset = Math.min(purgeOffset, 24F);
purgeOffset = Math.max(purgeOffset, 1F);
@ -1982,10 +1986,15 @@ public class ProductEditorComp extends Composite implements
}
private void updateExpireTime() {
if (textComp.isDisposed() || hoursSpnr.isDisposed()
|| dateTimeLbl.isDisposed()) {
return; // we're shutting down just return
}
int hours = hoursSpnr.getSelection() / 100;
int minuteInc = (hoursSpnr.getSelection() % 100) / 25;
int purgeOffset = hours * 60 + minuteInc * 15; // minutes
int sel = hoursSpnr.getSelection();
int hours = sel / 100;
int minuteInc = (sel % 100) / 25;
int purgeOffset = hours * TimeUtil.MINUTES_PER_HOUR + minuteInc * 15; // minutes
Date now = SimulatedTime.getSystemTime().getTime();
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
@ -2173,13 +2182,16 @@ public class ProductEditorComp extends Composite implements
}
// round to next "roundMinutes"
long roundSec = roundMinutes * 60;
long expireTimeSec = expireTime.getTime() / 1000; // converting to
// seconds
long roundSec = roundMinutes * TimeUtil.SECONDS_PER_MINUTE;
// converting to seconds
long expireTimeSec = expireTime.getTime() / TimeUtil.MILLIS_PER_SECOND;
long delta = expireTimeSec % roundSec;
long baseTime = (expireTimeSec / roundSec) * roundSec * 1000;
if (delta / 60 >= 1) {
expireTime.setTime(baseTime + (roundSec * 1000));
long baseTime = (expireTimeSec / roundSec) * roundSec
* TimeUtil.MILLIS_PER_SECOND;
if (delta / TimeUtil.SECONDS_PER_MINUTE >= 1) {
expireTime.setTime(baseTime
+ (roundSec * TimeUtil.MILLIS_PER_SECOND));
} else { // within 1 minute, don't add next increment
expireTime.setTime(baseTime);
}
@ -2295,13 +2307,15 @@ public class ProductEditorComp extends Composite implements
public void doAutoStuff() {
int autoWrite = 0;
Object autoWrite_obj = productDefinition.get("autoWrite");
if (autoWrite_obj != null)
if (autoWrite_obj != null) {
autoWrite = (Integer) autoWrite_obj;
}
int autoStore = 0;
Object autoStore_obj = productDefinition.get("autoStore");
if (autoStore_obj != null)
if (autoStore_obj != null) {
autoStore = (Integer) autoStore_obj;
}
if (autoWrite == 1) {
autoWrite();
@ -2319,8 +2333,9 @@ public class ProductEditorComp extends Composite implements
String fname = null;
if (productDefinition.get("outputFile") != null) {
fname = getDefString("outputFile");
if (fname.equals(EMPTY))
if (fname.equals(EMPTY)) {
return;
}
} else {
return;
}
@ -2341,8 +2356,9 @@ public class ProductEditorComp extends Composite implements
* Replace {prddir} with siteConfig.GFESUITE_PRDDIR if applicable.
*/
private String fixfname(String fname) {
if (fname.contains("{prddir}"))
if (fname.contains("{prddir}")) {
fname = fname.replace("{prddir}", prdDir);
}
return fname;
}
@ -2992,8 +3008,9 @@ public class ProductEditorComp extends Composite implements
// reschedule job to run at the top of the next minute
Calendar cal = Calendar.getInstance();
cal.setTime(SimulatedTime.getSystemTime().getTime());
int nextMinute = 60 - cal.get(Calendar.SECOND);
schedule(nextMinute * 1000);
int secondsTilNextMinute = TimeUtil.SECONDS_PER_MINUTE
- cal.get(Calendar.SECOND);
schedule(secondsTilNextMinute * TimeUtil.MILLIS_PER_SECOND);
return Status.OK_STATUS;
}
@ -3015,36 +3032,36 @@ public class ProductEditorComp extends Composite implements
return str;
}
/*
* Add Pop-up GUI for File, Edit, Options, and CallToActions
* at the location of mouse, when right click the mouse
* Add Pop-up GUI for File, Edit, Options, and CallToActions at the location
* of mouse, when right click the mouse
*/
private void createEditorPopupMenu(){
popupMenu = new Menu(textComp);
MenuItem fileMI = new MenuItem(popupMenu, SWT.CASCADE);
fileMI.setText("File");
Menu fileSubMenu = new Menu(popupMenu);
fileMI.setMenu(fileSubMenu);
createFileMenu(fileSubMenu);
private void createEditorPopupMenu() {
popupMenu = new Menu(textComp);
MenuItem fileMI = new MenuItem(popupMenu, SWT.CASCADE);
fileMI.setText("File");
Menu fileSubMenu = new Menu(popupMenu);
fileMI.setMenu(fileSubMenu);
createFileMenu(fileSubMenu);
MenuItem editMI = new MenuItem(popupMenu, SWT.CASCADE);
editMI.setText("Edit");
editMI.setText("Edit");
Menu editSubMenu = new Menu(popupMenu);
editMI.setMenu(editSubMenu);
editMI.setMenu(editSubMenu);
createEditMenu(editSubMenu);
MenuItem optionsMI = new MenuItem(popupMenu, SWT.CASCADE);
optionsMI.setText("Options");
MenuItem optionsMI = new MenuItem(popupMenu, SWT.CASCADE);
optionsMI.setText("Options");
Menu optionsSubMenu = new Menu(popupMenu);
optionsMI.setMenu(optionsSubMenu);
createOptionsMenu(optionsSubMenu);
MenuItem callToActionsMI = new MenuItem(popupMenu, SWT.CASCADE);
callToActionsMI.setText("CallToActions");
createOptionsMenu(optionsSubMenu);
MenuItem callToActionsMI = new MenuItem(popupMenu, SWT.CASCADE);
callToActionsMI.setText("CallToActions");
Menu callToActionsSubMenu = new Menu(popupMenu);
callToActionsMI.setMenu(callToActionsSubMenu);
createCallToActionsMenu(callToActionsSubMenu);
callToActionsMI.setMenu(callToActionsSubMenu);
createCallToActionsMenu(callToActionsSubMenu);
}
}

View file

@ -31,10 +31,14 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.python.PyConstants;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.viz.gfe.BaseGfePyController;
import com.raytheon.viz.gfe.core.DataManager;
@ -47,6 +51,8 @@ import com.raytheon.viz.gfe.core.DataManager;
* ------------ ---------- ----------- --------------------------
* Nov 5, 2008 njensen Initial creation
* Jan 8, 2013 1486 dgilling Support changes to BaseGfePyController.
* 02/12/2013 #1597 randerso Added logging to support GFE Performance metrics
*
* </pre>
*
* @author njensen
@ -57,6 +63,9 @@ public class ProcedureController extends BaseGfePyController {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcedureController.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
private LocalizationFile proceduresDir;
private LocalizationFile utilitiesDir;
@ -120,6 +129,9 @@ public class ProcedureController extends BaseGfePyController {
*/
public Object executeProcedure(String procedureName,
Map<String, Object> args) throws JepException {
ITimer timer = TimeUtil.getTimer();
timer.start();
if (!isInstantiated(procedureName)) {
instantiatePythonScript(procedureName);
}
@ -131,7 +143,12 @@ public class ProcedureController extends BaseGfePyController {
+ procedureName);
internalExecute("runProcedure", INTERFACE, args);
return getExecutionResult();
Object result = getExecutionResult();
timer.stop();
perfLog.logDuration("Running procedure " + procedureName,
timer.getElapsedTime());
return result;
}
@Override

View file

@ -37,13 +37,16 @@ import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
import com.raytheon.uf.common.python.concurrent.AbstractPythonScriptFactory;
import com.raytheon.uf.common.python.concurrent.IPythonExecutor;
import com.raytheon.uf.common.python.concurrent.PythonJobCoordinator;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.gfe.GFEOperationFailedException;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.IParmManager;
import com.raytheon.viz.gfe.core.griddata.IGridData;
@ -66,7 +69,8 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolController;
* ------------ ---------- ----------- --------------------------
* Feb 27, 2007 njensen Initial creation
* Jan 08, 2013 1486 dgilling Support changes to BaseGfePyController.
* 2/14/2013 mnash Change QueryScript to use new Python concurrency
* 02/14/2013 mnash Change QueryScript to use new Python concurrency
* 02/20/2013 #1597 randerso Added logging to support GFE Performance metrics
*
* </pre>
*
@ -78,6 +82,9 @@ public class Tool {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(Tool.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
private static final String CANCEL_MSG_START = "jep.JepException: <type 'exceptions.RuntimeError'>: Cancel: Cancel >>>";
private final IParmManager parmMgr;
@ -98,7 +105,7 @@ public class Tool {
*/
private ReferenceData trueEditArea;
private PythonJobCoordinator coordinator = null;
private PythonJobCoordinator<QueryScript> coordinator = null;
/**
* Constructor
@ -392,6 +399,9 @@ public class Tool {
final ReferenceData editArea, TimeRange timeRange, String varDict,
MissingDataMode missingDataMode, IProgressMonitor monitor)
throws SmartToolException {
ITimer timer = TimeUtil.getTimer();
timer.start();
MissingDataMode dataMode;
if (missingDataMode == null) {
dataMode = Message.inquireLastMessage(MissingDataModeMsg.class)
@ -437,6 +447,7 @@ public class Tool {
throw new SmartToolException(message);
// AFPS.UserAlertMsg_send_mh(self.__msgHand, message, "A", "GFE")
}
int numberOfGrids = grids.length;
// Make sure parm is mutable
if (parmToEdit != null) {
@ -458,14 +469,12 @@ public class Tool {
// Iterate over time range
// Process each grid in the time range.
int numberOfGrids = grids.length;
for (int i = 0; i < numberOfGrids; i++) {
boolean first = true;
for (IGridData grid : grids) {
if (monitor.isCanceled()) {
return;
}
IGridData grid = grids[i];
int index = i;
// # Show progress on a grid basis for numeric and parm-based
// if toolType == "numeric" or toolType == "parm-based":
// percent = (index+1)/numberOfGrids * 100.0
@ -479,7 +488,7 @@ public class Tool {
}
final Date timeInfluence;
Date seTime = DataManager.getCurrentInstance()
Date seTime = DataManagerUIFactory.getCurrentInstance()
.getSpatialDisplayManager().getSpatialEditorTime();
if (grids.length == 1 && grid.getGridTime().contains(seTime)) {
timeInfluence = seTime;
@ -487,14 +496,6 @@ public class Tool {
timeInfluence = grid.getGridTime().getStart();
}
TimeRange gridTimeRange = grid.getGridTime();
boolean first = false;
// boolean last = false;
if (index == 0) {
first = true;
}
// if (index == numberOfGrids - 1) {
// last = true;
// }
// Re-evaluate edit area if a query
if (editArea.isQuery()) {
@ -505,7 +506,7 @@ public class Tool {
IPythonExecutor<QueryScript, ReferenceData> executor = new QueryScriptExecutor(
"evaluate", argMap);
try {
Tool.this.trueEditArea = (ReferenceData) coordinator
Tool.this.trueEditArea = coordinator
.submitSyncJob(executor);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
@ -528,6 +529,7 @@ public class Tool {
numeric(parmToEdit, first, trueEditArea, gridTimeRange,
timeRange, timeInfluence, dataMode);
first = false;
if (monitor.isCanceled()) {
return;
@ -567,6 +569,11 @@ public class Tool {
+ toolName + ": " + e.getLocalizedMessage(), e);
} finally {
cleanUp(parmToEdit, saveParams, toolName, dataMode);
timer.stop();
perfLog.logDuration("Running smartTool " + toolName + " for "
+ numberOfGrids + " "
+ this.inputParm.getParmID().getParmName() + " grids",
timer.getElapsedTime());
}
}

View file

@ -24,10 +24,14 @@ import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.UUID;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData;
@ -61,6 +65,9 @@ public class TextFormatter extends AbstractGfeTask {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TextFormatter.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
private TextProductFinishListener listener;
private HashMap<String, Object> argMap;
@ -113,10 +120,14 @@ public class TextFormatter extends AbstractGfeTask {
argMap.put("logFile", getLogFile().getAbsolutePath());
script = FormatterScriptFactory.buildFormatterScript();
long t0 = System.currentTimeMillis();
ITimer timer = TimeUtil.getTimer();
timer.start();
forecast = (String) script.execute(argMap);
long t1 = System.currentTimeMillis();
System.out.println("Total text formatter time: " + (t1 - t0));
timer.stop();
String productName = (String) argMap
.get(ArgDictConstants.FORECAST_LIST);
perfLog.logDuration("Text Formatter " + productName,
timer.getElapsedTime());
state = ConfigData.productStateEnum.Finished;
} catch (Throwable t) {

View file

@ -17,7 +17,14 @@
<programArgs>-data @user.home/caveData -user @user.home/caveData -clean -consoleLog -alertviz</programArgs>
<vmArgs>-Xincgc -Xmx1024M -Dosgi.instance.area.readOnly=true
-Dosgi.hook.configurators.exclude=org.eclipse.core.runtime.internal.adaptor.EclipseLogHook,org.eclipse.core.runtime.internal.adaptor.EclipseErrorHandler
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m -Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme -Dawips.mode=pypies -Dqpid.dest_syntax=BURL -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
-XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass
-Dorg.eclipse.update.reconcile=false -XX:MaxPermSize=128m
-Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme
-Dawips.mode=pypies -Dqpid.dest_syntax=BURL
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dlog4j.configuration=log4j-viz-core-developer.xml</vmArgs>
<vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin>
</launcherArgs>
@ -35,10 +42,12 @@
</win>
</launcher>
<vm>
<windows include="true">jdk1.6.0</windows>
</vm>
<plugins>
</plugins>

View file

@ -1,19 +1,19 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##

View file

@ -63,6 +63,7 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory;
* ------------ ---------- ----------- --------------------------
* 04/08/08 #875 bphillip Initial Creation
* 06/17/08 #940 bphillip Implemented GFE Locking
* 02/10/13 #1603 randerso Returned number of records purged from timePurge
*
* </pre>
*

View file

@ -81,6 +81,10 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger;
* 07/12/12 15162 ryu added check for invalid db
* 10/10/12 #1260 randerso Added exception handling for domain not
* overlapping the dataset
* 02/10/13 #1603 randerso General code cleanup, improved purge logging,
* fixed a purge inefficiency,
* fixed error which caused D2D purging to remove
* smartInit hdf5 data
*
* </pre>
*

View file

@ -69,6 +69,8 @@ import com.raytheon.uf.common.time.TimeRange;
* 05/04/12 #574 dgilling Update class to better match AWIPS1.
* 01/14/13 #1469 bkowal The hdf5 data directory is no longer included
* in the gfeBaseDataDir.
* 02/10/13 #1603 randerso Moved removeFromDb, removeFromHDF5 and deleteModelHDF5
* methods down to IFPGridDatabase
*
* </pre>
*

View file

@ -19,12 +19,9 @@
**/
package com.raytheon.edex.plugin.gfe.server.handler;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
import com.raytheon.edex.plugin.gfe.isc.IscSendQueue;
@ -39,6 +36,12 @@ import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.dataplugin.gfe.server.request.SaveGridRequest;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* GFE task for saving grids
@ -51,13 +54,18 @@ import com.raytheon.uf.common.serialization.comm.IRequestHandler;
* 01/29/09 #1271 njensen Rewrote for thrift capabilities
* 06/24/09 njensen Added sending notifications
* 09/22/09 3058 rjpeter Converted to IRequestHandler
* 02/12/2013 #1597 randerso Added logging to support GFE Performance investigation
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class SaveGfeGridHandler implements IRequestHandler<SaveGfeGridRequest> {
protected final transient Log logger = LogFactory.getLog(getClass());
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SaveGfeGridHandler.class);
private final IPerformanceStatusHandler perfLog = PerformanceStatus
.getHandler("GFE:");
@Override
public ServerResponse<?> handleRequest(SaveGfeGridRequest request)
@ -72,14 +80,23 @@ public class SaveGfeGridHandler implements IRequestHandler<SaveGfeGridRequest> {
}
try {
ITimer timer = TimeUtil.getTimer();
timer.start();
sr = GridParmManager.saveGridData(saveRequest, workstationID,
siteID);
timer.stop();
perfLog.logDuration("Save Grids: GridParmManager.saveGridData",
timer.getElapsedTime());
// check for sending to ISC
timer.reset();
timer.start();
IFPServerConfig serverConfig = IFPServerConfigManager
.getServerConfig(siteID);
String iscrta = serverConfig.iscRoutingTableAddress().get("ANCF");
if (serverConfig.requestISC() && clientSendStatus && iscrta != null) {
List<IscSendRecord> iscSendRequests = new ArrayList<IscSendRecord>(
saveRequest.size());
for (SaveGridRequest save : saveRequest) {
DatabaseID dbid = save.getParmId().getDbId();
// ensure Fcst database
@ -91,19 +108,26 @@ public class SaveGfeGridHandler implements IRequestHandler<SaveGfeGridRequest> {
save.getParmId(),
save.getReplacementTimeRange(), "",
serverConfig.sendiscOnSave());
IscSendQueue.sendToQueue(Arrays.asList(sendReq));
iscSendRequests.add(sendReq);
}
}
IscSendQueue.sendToQueue(iscSendRequests);
timer.stop();
perfLog.logDuration("Save Grids: Queueing ISC send requests",
timer.getElapsedTime());
}
} catch (GfeException e) {
logger.error("Error getting discrete or wx definition", e);
statusHandler.error("Error getting discrete or wx definition", e);
sr = new ServerResponse<Object>();
sr.addMessage("Error getting discrete or wx definition on server");
}
if (sr.isOkay()) {
try {
ITimer timer = TimeUtil.getTimer();
timer.start();
ServerResponse<?> notifyResponse = SendNotifications.send(sr
.getNotifications());
if (!notifyResponse.isOkay()) {
@ -111,8 +135,11 @@ public class SaveGfeGridHandler implements IRequestHandler<SaveGfeGridRequest> {
sr.addMessage(msg.getMessage());
}
}
timer.stop();
perfLog.logDuration("Save Grids: Sending notifications",
timer.getElapsedTime());
} catch (Exception e) {
logger.error("Error sending save notification", e);
statusHandler.error("Error sending save notification", e);
sr.addMessage("Error sending save notification - "
+ e.getMessage());
}

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.time.domain.api.ITimePoint;
* Jan 17, 2013 1357 mpduff Change MILLIS_PER_MONTH to MILLIS_PER_30_DAYS
* Jan 22, 2013 1484 mpduff Add HOURS_PER_WEEK.
* Jan 22, 2013 1519 djohnson Add MINUTES_PER_DAY.
* Feb 26, 2013 1597 randerso Add SECONDS_PER_HOUR.
*
* </pre>
*
@ -96,6 +97,9 @@ public final class TimeUtil {
public static final int MINUTES_PER_HOUR = 60;
public static final long SECONDS_PER_HOUR = SECONDS_PER_MINUTE
* MINUTES_PER_HOUR;
public static final int HOURS_PER_DAY = 24;
public static final int HOURS_PER_HALF_DAY = HOURS_PER_DAY / 2;

View file

@ -52,6 +52,7 @@ import java.util.zip.GZIPOutputStream;
* Jun 28, 2012 0819 djohnson Add write method.
* Jul 06, 2012 798 jkorman Added more robust {@link #copyFile}. Added methods
* to create temporary directories and files.
* 02/15/2013 #1597 randerso Fixed error when copying empty files
*
* </pre>
*
@ -619,7 +620,7 @@ public class FileUtil {
public static boolean isValidFilename(String fileName) {
return VALID_FILENAME.matcher(fileName).matches();
}
/**
* Write the contents of an input stream to a file.
*
@ -656,14 +657,15 @@ public class FileUtil {
* An error occurred while copying the data.
* @throws IllegalArgumentException
* The position is less than zero or greater than the length of
* the source file or either of the source, target files are null.
* the source file or either of the source, target files are
* null.
*/
public static boolean copyFile(File source, File target, int position)
throws IOException {
boolean status = false;
if (source != null) {
if (target != null) {
if ((position >= 0) && (position < source.length())) {
if ((position >= 0) && (position <= source.length())) {
FileInputStream fis = null;
FileOutputStream fos = null;
@ -717,7 +719,8 @@ public class FileUtil {
throw new IllegalArgumentException(msg);
}
} else {
throw new IllegalArgumentException("target file reference is null");
throw new IllegalArgumentException(
"target file reference is null");
}
} else {
throw new IllegalArgumentException("source file reference is null");