Skip to content

Commit

Permalink
#1066 - Recommender status info
Browse files Browse the repository at this point in the history
- Do not log EOF exceptioin when user leaves page
- Re-render the learning curve chart via websocket instead of by the RenderAnnotationsEvent
  • Loading branch information
reckart committed Oct 1, 2019
1 parent bb91c0e commit 553b41d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 2 additions & 0 deletions inception-app-webapp/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<Logger name="org.springframework.beans.factory.config.PropertiesFactoryBean" level="ERROR"/>
<!-- Avoid warning on cookies with an invalid expiration date - cf. issue #739 -->
<Logger name="org.apache.http.client.protocol.ResponseProcessCookies" level="ERROR"/>
<!-- Avoid error when user leaves websocket-enabled page -->
<Logger name="org.apache.wicket.protocol.ws.javax.WicketEndpoint" level="FATAL"/>
<Root level="warn">
<AppenderRef ref="ConsoleAppender" />
<AppenderRef ref="ProjectAppender" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.protocol.ws.api.WebSocketBehavior;
import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler;
import org.apache.wicket.protocol.ws.api.message.ConnectedMessage;
import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wicketstuff.event.annotation.OnEvent;

import de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState;
import de.tudarmstadt.ukp.clarin.webanno.api.annotation.rendering.event.RenderAnnotationsEvent;
import de.tudarmstadt.ukp.inception.log.EventRepository;
import de.tudarmstadt.ukp.inception.log.model.LoggedEvent;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
import de.tudarmstadt.ukp.inception.recommendation.api.model.Recommender;
import de.tudarmstadt.ukp.inception.recommendation.chart.ChartPanel;
import de.tudarmstadt.ukp.inception.recommendation.event.RecommenderEvaluationResultEvent;
import de.tudarmstadt.ukp.inception.recommendation.log.RecommenderEvaluationResultEventAdapter.Details;
import de.tudarmstadt.ukp.inception.recommendation.model.LearningCurve;
import de.tudarmstadt.ukp.inception.recommendation.model.RecommenderEvaluationScoreMetricEnum;
Expand Down Expand Up @@ -93,6 +95,28 @@ public LearningCurveChartPanel(String aId, IModel<AnnotatorState> aModel)
add(dropDownPanel);

selectedMetric = RecommenderEvaluationScoreMetricEnum.Accuracy;

add(new WebSocketBehavior() {

private static final long serialVersionUID = 1L;

@Override
protected void onConnect(ConnectedMessage aMessage)
{
super.onConnect(aMessage);
LOG.debug("User with sessionID {} connected.",
aMessage.getSessionId());
}

@Override
protected void onPush(WebSocketRequestHandler aHandler, IWebSocketPushMessage aMessage)
{
if (aMessage instanceof RecommenderEvaluationResultEvent) {
LOG.debug("Received event: {}", aMessage.toString());
aHandler.add(LearningCurveChartPanel.this);
}
}
});
}


Expand All @@ -115,14 +139,6 @@ public void onEvent(IEvent<?> event)
}
}

@OnEvent
public void onRenderAnnotations(RenderAnnotationsEvent aEvent)
{
LOG.trace("rendered annotation event");

aEvent.getRequestHandler().add(this);
}

/**
* Returns chart data wrapped in LearningCurve
*/
Expand Down

0 comments on commit 553b41d

Please sign in to comment.