Initial import.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-executor@176720 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6fd062f35f
commit
6071805018
|
@ -50,7 +50,8 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param operatorName operator name
|
* @param operatorName
|
||||||
|
* operator name
|
||||||
*/
|
*/
|
||||||
public ComputationStatusPanel(String operatorName) {
|
public ComputationStatusPanel(String operatorName) {
|
||||||
super();
|
super();
|
||||||
|
@ -66,8 +67,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
private void create() {
|
private void create() {
|
||||||
vert = new VerticalLayoutContainer();
|
vert = new VerticalLayoutContainer();
|
||||||
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
||||||
"<div class='computationStatusTitle'><p>Computation of <b>"
|
"<div class='computationStatusTitle'><p>Computation of <b>" + operatorName + "</b></p></div>");
|
||||||
+ operatorName + "</b></p></div>");
|
|
||||||
vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0)));
|
vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||||
add(vert);
|
add(vert);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
@ -86,8 +86,10 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
*/
|
*/
|
||||||
// vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0)));
|
// vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||||
|
|
||||||
vert.add(new HtmlLayoutContainer("<p>Created, the id is "
|
vert.add(new HtmlLayoutContainer("<p>Created, the id is " + computationId.getId() + "</p>"));
|
||||||
+ computationId.getId() + "</p>"));
|
|
||||||
|
vert.add(new HtmlLayoutContainer("<p>DataMiner>Computations>"
|
||||||
|
+ computationId.getOperatorName().toUpperCase() + "_ID_" + computationId.getId() + "</p>"));
|
||||||
|
|
||||||
TextButton equivalentRequestBtn = new TextButton();
|
TextButton equivalentRequestBtn = new TextButton();
|
||||||
equivalentRequestBtn.setText("Show");
|
equivalentRequestBtn.setText("Show");
|
||||||
|
@ -101,8 +103,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
FieldLabel equivalentRequestLabel = new FieldLabel(
|
FieldLabel equivalentRequestLabel = new FieldLabel(equivalentRequestBtn, "Equivalent Get Request");
|
||||||
equivalentRequestBtn, "Equivalent Get Request");
|
|
||||||
equivalentRequestLabel.setLabelWidth(140);
|
equivalentRequestLabel.setLabelWidth(140);
|
||||||
// vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1,
|
// vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1,
|
||||||
// new Margins(0)));
|
// new Margins(0)));
|
||||||
|
@ -123,24 +124,20 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cancelComputationBtn.getElement().getStyle()
|
cancelComputationBtn.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||||
.setMarginBottom(36, Unit.PX);
|
|
||||||
|
|
||||||
vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1,
|
vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||||
new Margins(0)));
|
|
||||||
forceLayout();
|
forceLayout();
|
||||||
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
|
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showEquivalentRequestDialog() {
|
private void showEquivalentRequestDialog() {
|
||||||
EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(
|
EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(computationId);
|
||||||
computationId);
|
|
||||||
equivalentRequestDialog.show();
|
equivalentRequestDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelComputation() {
|
private void cancelComputation() {
|
||||||
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(
|
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(computationId);
|
||||||
computationId);
|
|
||||||
EventBusProvider.INSTANCE.fireEvent(event);
|
EventBusProvider.INSTANCE.fireEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +146,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
* @param operator
|
* @param operator
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void computationTerminated(ComputationId computationId,
|
private void computationTerminated(ComputationId computationId, ComputationStatus computationStatus) {
|
||||||
ComputationStatus computationStatus) {
|
|
||||||
Log.debug("Computation Terminated");
|
Log.debug("Computation Terminated");
|
||||||
Log.debug("Computation Status:" + computationStatus);
|
Log.debug("Computation Status:" + computationStatus);
|
||||||
if (terminated == false) {
|
if (terminated == false) {
|
||||||
|
@ -158,17 +154,14 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
cancelComputationBtn.setVisible(false);
|
cancelComputationBtn.setVisible(false);
|
||||||
if (computationStatus.isComplete()) {
|
if (computationStatus.isComplete()) {
|
||||||
Log.debug("Computation is Complete");
|
Log.debug("Computation is Complete");
|
||||||
Info.display("Terminated",
|
Info.display("Terminated", "The computation " + computationId.getId() + " of "
|
||||||
"The computation " + computationId.getId() + " of "
|
+ computationId.getOperatorName() + " is terminated correctly.");
|
||||||
+ computationId.getOperatorName()
|
|
||||||
+ " is terminated correctly.");
|
|
||||||
int index = vert.getWidgetIndex(progressBar);
|
int index = vert.getWidgetIndex(progressBar);
|
||||||
vert.remove(index);
|
vert.remove(index);
|
||||||
// TODO
|
// TODO
|
||||||
progressBar = new GreenProgressBar();
|
progressBar = new GreenProgressBar();
|
||||||
progressBar.updateProgress(1, "Computation Complete");
|
progressBar.updateProgress(1, "Computation Complete");
|
||||||
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
|
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
|
||||||
new Margins(20)));
|
|
||||||
showComputationCompletedOutput();
|
showComputationCompletedOutput();
|
||||||
} else if (computationStatus.isFailed()) {
|
} else if (computationStatus.isFailed()) {
|
||||||
Log.debug("Computation is Failed");
|
Log.debug("Computation is Failed");
|
||||||
|
@ -176,49 +169,37 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
if (computationStatus.getError() == null) {
|
if (computationStatus.getError() == null) {
|
||||||
errorMessage = new String("Computation Failed!");
|
errorMessage = new String("Computation Failed!");
|
||||||
} else {
|
} else {
|
||||||
errorMessage = computationStatus.getError()
|
errorMessage = computationStatus.getError().getLocalizedMessage();
|
||||||
.getLocalizedMessage();
|
|
||||||
ElementsHighlights el = new ElementsHighlights();
|
ElementsHighlights el = new ElementsHighlights();
|
||||||
errorMessage = el.createLinkFromText(errorMessage);
|
errorMessage = el.createLinkFromText(errorMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
Info.display("Failed",
|
Info.display("Failed", "The computation " + computationId.getId() + " of "
|
||||||
"The computation " + computationId.getId() + " of "
|
+ computationId.getOperatorName() + " is failed.");
|
||||||
+ computationId.getOperatorName()
|
UtilsGXT3.alert("Failed", "The computation " + computationId.getId() + " of "
|
||||||
+ " is failed.");
|
+ computationId.getOperatorName() + " has failed.</br>" + errorMessage);
|
||||||
UtilsGXT3.alert("Failed",
|
|
||||||
"The computation " + computationId.getId() + " of "
|
|
||||||
+ computationId.getOperatorName()
|
|
||||||
+ " has failed.</br>" + errorMessage);
|
|
||||||
int index = vert.getWidgetIndex(progressBar);
|
int index = vert.getWidgetIndex(progressBar);
|
||||||
vert.remove(index);
|
vert.remove(index);
|
||||||
// TODO
|
// TODO
|
||||||
progressBar = new RedProgressBar();
|
progressBar = new RedProgressBar();
|
||||||
progressBar.updateProgress(1, "Computation Fail");
|
progressBar.updateProgress(1, "Computation Fail");
|
||||||
progressBar.getElement().getStyle()
|
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||||
.setMarginBottom(36, Unit.PX);
|
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
|
||||||
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
|
|
||||||
new Margins(20)));
|
|
||||||
} else if (computationStatus.isCancelled()) {
|
} else if (computationStatus.isCancelled()) {
|
||||||
Log.debug("Computation Cancelled");
|
Log.debug("Computation Cancelled");
|
||||||
String errorMessage;
|
String errorMessage;
|
||||||
errorMessage = new String("Computation Cancelled!");
|
errorMessage = new String("Computation Cancelled!");
|
||||||
Info.display("Info", "The computation " + computationId.getId()
|
Info.display("Info", "The computation " + computationId.getId() + " of "
|
||||||
+ " of " + computationId.getOperatorName()
|
+ computationId.getOperatorName() + " has been cancelled.");
|
||||||
+ " has been cancelled.");
|
UtilsGXT3.info("Info", "The computation " + computationId.getId() + " of "
|
||||||
UtilsGXT3.info("Info",
|
+ computationId.getOperatorName() + " has been cancelled.</br>" + errorMessage);
|
||||||
"The computation " + computationId.getId() + " of "
|
|
||||||
+ computationId.getOperatorName()
|
|
||||||
+ " has been cancelled.</br>" + errorMessage);
|
|
||||||
int index = vert.getWidgetIndex(progressBar);
|
int index = vert.getWidgetIndex(progressBar);
|
||||||
vert.remove(index);
|
vert.remove(index);
|
||||||
// TODO
|
// TODO
|
||||||
progressBar = new OrangeProgressBar();
|
progressBar = new OrangeProgressBar();
|
||||||
progressBar.updateProgress(1, "Computation Cancelled");
|
progressBar.updateProgress(1, "Computation Cancelled");
|
||||||
progressBar.getElement().getStyle()
|
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||||
.setMarginBottom(36, Unit.PX);
|
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
|
||||||
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
|
|
||||||
new Margins(20)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -231,16 +212,11 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
*/
|
*/
|
||||||
private void showComputationCompletedOutput() {
|
private void showComputationCompletedOutput() {
|
||||||
HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer(
|
HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer(
|
||||||
"<p>The computation <b>" + computationId.getOperatorName()
|
"<p>The computation <b>" + computationId.getOperatorName() + "</b> finished.</p>");
|
||||||
+ "</b> finished.</p>");
|
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||||
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1,
|
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(computationId);
|
||||||
new Margins(0)));
|
computationOutputPanel.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||||
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(
|
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
computationId);
|
|
||||||
computationOutputPanel.getElement().getStyle()
|
|
||||||
.setMarginBottom(36, Unit.PX);
|
|
||||||
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1,
|
|
||||||
new Margins(0)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,8 +224,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
* @param computationStatus
|
* @param computationStatus
|
||||||
*/
|
*/
|
||||||
private void updateStatus(ComputationStatus computationStatus) {
|
private void updateStatus(ComputationStatus computationStatus) {
|
||||||
Log.debug("Conputation Status Panel ::Update Status "
|
Log.debug("Conputation Status Panel ::Update Status " + computationStatus);
|
||||||
+ computationStatus);
|
|
||||||
if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0)
|
if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0)
|
||||||
progressBar.updateText("Accepted...");
|
progressBar.updateText("Accepted...");
|
||||||
else {
|
else {
|
||||||
|
@ -257,8 +232,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
if (percentage == 0) {
|
if (percentage == 0) {
|
||||||
progressBar.updateText("Running, 0% Complete");
|
progressBar.updateText("Running, 0% Complete");
|
||||||
} else {
|
} else {
|
||||||
progressBar.updateProgress(percentage / 100, "Running, "
|
progressBar.updateProgress(percentage / 100, "Running, " + percentage + "% Complete");
|
||||||
+ percentage + "% Complete");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
@ -269,8 +243,8 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Log.debug("Timer run .....");
|
Log.debug("Timer run .....");
|
||||||
DataMinerExecutorServiceAsync.INSTANCE.getComputationStatus(
|
DataMinerExecutorServiceAsync.INSTANCE.getComputationStatus(computationId,
|
||||||
computationId, new AsyncCallback<ComputationStatus>() {
|
new AsyncCallback<ComputationStatus>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -278,25 +252,19 @@ public class ComputationStatusPanel extends SimpleContainer {
|
||||||
vert.remove(index);
|
vert.remove(index);
|
||||||
// TODO
|
// TODO
|
||||||
progressBar = new RedProgressBar();
|
progressBar = new RedProgressBar();
|
||||||
progressBar.updateProgress(1,
|
progressBar.updateProgress(1, "Failed to get the status");
|
||||||
"Failed to get the status");
|
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||||
progressBar.getElement().getStyle()
|
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
|
||||||
.setMarginBottom(36, Unit.PX);
|
|
||||||
vert.insert(progressBar, index,
|
|
||||||
new VerticalLayoutData(1, -1, new Margins(
|
|
||||||
20)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(
|
public void onSuccess(ComputationStatus computationStatus) {
|
||||||
ComputationStatus computationStatus) {
|
|
||||||
Log.debug("ComputationStatus: " + computationStatus);
|
Log.debug("ComputationStatus: " + computationStatus);
|
||||||
if (computationStatus != null) {
|
if (computationStatus != null) {
|
||||||
if (computationStatus.isTerminated()) {
|
if (computationStatus.isTerminated()) {
|
||||||
ComputationTimer.this.cancel();
|
ComputationTimer.this.cancel();
|
||||||
computationTerminated(computationId,
|
computationTerminated(computationId, computationStatus);
|
||||||
computationStatus);
|
|
||||||
} else
|
} else
|
||||||
updateStatus(computationStatus);
|
updateStatus(computationStatus);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue