refs 2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Added DataMiner Exception visualization git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128606 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c67176d5fb
commit
741c061e79
|
@ -286,13 +286,11 @@ public class DataMinerManagerController {
|
|||
|
||||
private void startComputationRequest(
|
||||
final StartComputationExecutionRequestEvent event) {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(),
|
||||
new AsyncCallback<ComputationId>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session!");
|
||||
EventBusProvider.INSTANCE
|
||||
|
@ -308,7 +306,6 @@ public class DataMinerManagerController {
|
|||
|
||||
@Override
|
||||
public void onSuccess(ComputationId computationId) {
|
||||
monitor.hide();
|
||||
if (computationId == null)
|
||||
UtilsGXT3.alert("Error",
|
||||
"Failed start computation "
|
||||
|
@ -333,13 +330,11 @@ public class DataMinerManagerController {
|
|||
private void cancelComputationRequest(
|
||||
CancelComputationExecutionRequestEvent event) {
|
||||
final ComputationId computationId = event.getComputationId();
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE.cancelComputation(computationId,
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session!");
|
||||
EventBusProvider.INSTANCE
|
||||
|
@ -355,7 +350,6 @@ public class DataMinerManagerController {
|
|||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
monitor.hide();
|
||||
Log.debug("Computation Deleted!");
|
||||
|
||||
}
|
||||
|
@ -364,13 +358,12 @@ public class DataMinerManagerController {
|
|||
|
||||
private void resubmitComputationRequest(
|
||||
final ResubmitComputationExecutionRequestEvent event) {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.resubmit(
|
||||
event.getItemDescription(), new AsyncCallback<ComputationId>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session!");
|
||||
EventBusProvider.INSTANCE
|
||||
|
@ -385,7 +378,6 @@ public class DataMinerManagerController {
|
|||
|
||||
@Override
|
||||
public void onSuccess(ComputationId result) {
|
||||
monitor.hide();
|
||||
if (result == null)
|
||||
UtilsGXT3
|
||||
.alert("Error",
|
||||
|
|
|
@ -3,38 +3,30 @@ package org.gcube.portlets.user.dataminermanager.client.bean;
|
|||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.output.Resource;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.exception.DataMinerServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationStatus implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1943128398882978439L;
|
||||
|
||||
public enum Status {
|
||||
PENDING,
|
||||
RUNNING,
|
||||
COMPLETE,
|
||||
FAILED
|
||||
ACCEPTED, RUNNING, COMPLETE, FAILED
|
||||
};
|
||||
|
||||
|
||||
private double percentage;
|
||||
private Status status;
|
||||
private Date endDate;
|
||||
private String message;
|
||||
private Resource errResource;
|
||||
|
||||
private DataMinerServiceException error;
|
||||
|
||||
public ComputationStatus() {
|
||||
this.status = Status.PENDING;
|
||||
this.status = Status.ACCEPTED;
|
||||
}
|
||||
|
||||
public ComputationStatus(double percentage) {
|
||||
|
@ -49,20 +41,10 @@ public class ComputationStatus implements Serializable {
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
public double getPercentage() {
|
||||
return percentage;
|
||||
}
|
||||
|
||||
public void setPercentage(float percentage) {
|
||||
this.percentage = percentage;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
public ComputationStatus(DataMinerServiceException error) {
|
||||
super();
|
||||
this.percentage = 100f;
|
||||
this.status = Status.FAILED;
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
|
@ -77,59 +59,64 @@ public class ComputationStatus implements Serializable {
|
|||
return this.status == Status.RUNNING;
|
||||
}
|
||||
|
||||
public boolean isPending() {
|
||||
return this.status == Status.PENDING;
|
||||
public boolean isAccepted() {
|
||||
return this.status == Status.ACCEPTED;
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return false;
|
||||
//return this.status == Status.FAILED;
|
||||
}
|
||||
|
||||
public boolean isTerminated() {
|
||||
return status == Status.COMPLETE || status == Status.FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endDate the endDate to set
|
||||
*/
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
public double getPercentage() {
|
||||
return percentage;
|
||||
}
|
||||
|
||||
public void setPercentage(double percentage) {
|
||||
this.percentage = percentage;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endDate
|
||||
*/
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message the message to set
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public Resource getErrResource()
|
||||
{
|
||||
return errResource;
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public void setErrResource(Resource errRes)
|
||||
{
|
||||
this.errResource= errRes;
|
||||
public DataMinerServiceException getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(DataMinerServiceException error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ComputationStatus [percentage=" + percentage + ", status="
|
||||
+ status + ", endDate=" + endDate + ", message=" + message
|
||||
+ ", errResource=" + errResource + "]";
|
||||
+ ", error=" + error + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.gcube.portlets.user.dataminermanager.shared.data.computations.Computa
|
|||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
|
@ -148,12 +147,10 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
} else if (computationStatus.isFailed()) {
|
||||
Log.debug("Computation is Failed");
|
||||
String errorMessage;
|
||||
if (computationStatus.getErrResource() == null
|
||||
|| computationStatus.getErrResource().getDescription() == null) {
|
||||
if (computationStatus.getError() == null) {
|
||||
errorMessage = new String("Computation Failed!");
|
||||
} else {
|
||||
errorMessage = computationStatus.getErrResource()
|
||||
.getDescription();
|
||||
errorMessage = computationStatus.getError().getLocalizedMessage();
|
||||
}
|
||||
Info.display("Failed",
|
||||
"The computation " + computationId.getId() + " of "
|
||||
|
@ -206,14 +203,15 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
*/
|
||||
private void updateStatus(ComputationStatus computationStatus) {
|
||||
Log.debug("Conputation Status Panel ::Update Status ");
|
||||
if (computationStatus.getStatus() == Status.PENDING)
|
||||
progressBar.updateText("Pending...");
|
||||
if (computationStatus.getStatus().compareTo(Status.ACCEPTED)==0)
|
||||
progressBar.updateText("Accepted...");
|
||||
else {
|
||||
double percentage = computationStatus.getPercentage();
|
||||
progressBar.updateProgress(percentage/100, "Running, "
|
||||
+ NumberFormat.getFormat("0.00").format(percentage)
|
||||
+ percentage
|
||||
+ "% Complete");
|
||||
}
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
private class ComputationTimer extends Timer {
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.gcube.portlets.user.dataminermanager.shared.data.output.ImageResource
|
|||
import org.gcube.portlets.user.dataminermanager.shared.data.output.MapResource;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.output.ObjectResource;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.output.Resource;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.exception.DataMinerServiceException;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.parameters.ObjectParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.parameters.TabularListParameter;
|
||||
|
@ -846,49 +847,53 @@ public class SClient4WPS extends SClient {
|
|||
Status.FAILED, 100f);
|
||||
} else {
|
||||
|
||||
int status = statusType.getProcessStarted() == null ? -1
|
||||
: statusType.getProcessStarted()
|
||||
.getPercentCompleted();
|
||||
/*
|
||||
* String processStarted =
|
||||
* statusType.getProcessStarted() == null ? null
|
||||
* :
|
||||
* statusType.getProcessStarted().getStringValue
|
||||
* ();
|
||||
*/
|
||||
String failure = statusType.getProcessFailed() == null ? null
|
||||
: statusType.getProcessFailed()
|
||||
.getExceptionReport()
|
||||
.toString();
|
||||
String accepted = statusType
|
||||
.getProcessAccepted() == null ? null
|
||||
: statusType.getProcessAccepted();
|
||||
String success = statusType
|
||||
.getProcessSucceeded() == null ? null
|
||||
: statusType.getProcessSucceeded();
|
||||
String paused = statusType.getProcessPaused() == null ? null
|
||||
if ((failure != null && !failure.isEmpty())) {
|
||||
logger.debug("WPS FAILURE: " + failure);
|
||||
computationStatus = new ComputationStatus(
|
||||
new DataMinerServiceException(
|
||||
failure));
|
||||
} else {
|
||||
String paused = statusType
|
||||
.getProcessPaused() == null ? null
|
||||
: statusType.getProcessPaused()
|
||||
.getStringValue();
|
||||
if (paused != null && !paused.isEmpty()) {
|
||||
logger.debug("WPS PAUSED: " + paused);
|
||||
computationStatus = new ComputationStatus(
|
||||
new DataMinerServiceException(
|
||||
paused));
|
||||
} else {
|
||||
String success = statusType
|
||||
.getProcessSucceeded() == null ? null
|
||||
: statusType
|
||||
.getProcessSucceeded();
|
||||
|
||||
if ((failure != null && failure.length() > 0)
|
||||
|| (paused != null && paused.length() > 0)) {
|
||||
logger.debug("WPS FAILURE: " + failure
|
||||
+ " OR PAUSED: " + paused);
|
||||
computationStatus = new ComputationStatus(
|
||||
Status.FAILED, 100f);
|
||||
} else {
|
||||
if (accepted != null
|
||||
&& accepted.length() > 0) {
|
||||
logger.debug("WPS ACCEPTED");
|
||||
computationStatus = new ComputationStatus(
|
||||
Status.PENDING, 0f);
|
||||
} else {
|
||||
if (success != null
|
||||
&& success.length() > 0) {
|
||||
&& !success.isEmpty()) {
|
||||
logger.debug("WPS SUCCESS");
|
||||
computationStatus = new ComputationStatus(
|
||||
Status.COMPLETE, 100f);
|
||||
} else {
|
||||
String accepted = statusType
|
||||
.getProcessAccepted() == null ? null
|
||||
: statusType
|
||||
.getProcessAccepted();
|
||||
if (accepted != null
|
||||
&& !accepted.isEmpty()) {
|
||||
logger.debug("WPS ACCEPTED");
|
||||
computationStatus = new ComputationStatus(
|
||||
Status.ACCEPTED, 0f);
|
||||
} else {
|
||||
int status = statusType
|
||||
.getProcessStarted() == null ? -1
|
||||
: statusType
|
||||
.getProcessStarted()
|
||||
.getPercentCompleted();
|
||||
|
||||
if (status >= 0) {
|
||||
Float statusd = (float) status;
|
||||
try {
|
||||
|
@ -902,8 +907,11 @@ public class SClient4WPS extends SClient {
|
|||
logger.debug("WPS STATUS:"
|
||||
+ statusd);
|
||||
computationStatus = new ComputationStatus(
|
||||
Status.RUNNING, statusd);
|
||||
Status.RUNNING,
|
||||
statusd);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1282,10 +1290,14 @@ public class SClient4WPS extends SClient {
|
|||
}
|
||||
}
|
||||
|
||||
ComputationValueBuilder computationValueBuilder=new ComputationValueBuilder(inputValueParameters);
|
||||
LinkedHashMap<String, ComputationValue> inputParameters = computationValueBuilder.create();
|
||||
computationValueBuilder=new ComputationValueBuilder(outputValueParameters);
|
||||
LinkedHashMap<String, ComputationValue> outputParameters = computationValueBuilder.create();
|
||||
ComputationValueBuilder computationValueBuilder = new ComputationValueBuilder(
|
||||
inputValueParameters);
|
||||
LinkedHashMap<String, ComputationValue> inputParameters = computationValueBuilder
|
||||
.create();
|
||||
computationValueBuilder = new ComputationValueBuilder(
|
||||
outputValueParameters);
|
||||
LinkedHashMap<String, ComputationValue> outputParameters = computationValueBuilder
|
||||
.create();
|
||||
|
||||
ComputationData computationData = new ComputationData(computationId,
|
||||
inputParameters, outputParameters, operatorDescritpion,
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package org.gcube.portlets.user.dataminermanager.shared.exception;
|
||||
|
||||
/**
|
||||
* DataMiner Service Exception
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class DataMinerServiceException extends
|
||||
ServiceException {
|
||||
|
||||
private static final long serialVersionUID = -4831171355042165166L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public DataMinerServiceException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public DataMinerServiceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
* @param t
|
||||
*/
|
||||
public DataMinerServiceException(String message, Throwable t) {
|
||||
super(message, t);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue