Added show results
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@168967 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
041138f8cd
commit
a3acbd487c
|
@ -4,6 +4,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOutput;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
|
||||
|
@ -23,6 +24,8 @@ import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConf
|
|||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEventHandler;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowListOfTaskConfigurationsEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowListOfTaskConfigurationsEventHandler;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.TaskComputationFinishedEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.TaskComputationFinishedEventHandler;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetServiceAsync;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.WsTaskExecutorWidgetViewManager;
|
||||
|
@ -243,6 +246,64 @@ public class WsTaskExecutorWidget {
|
|||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(TaskComputationFinishedEvent.TYPE, new TaskComputationFinishedEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onTaskFinished(
|
||||
TaskComputationFinishedEvent taskComputationTerminatedEvent) {
|
||||
|
||||
if(taskComputationTerminatedEvent.getWsItem()!=null){
|
||||
|
||||
GWT.log("Task finished with status "+taskComputationTerminatedEvent.getTaskExecutionStatus()+" cancelling the polling");
|
||||
viewManager.cancelMonitor(taskComputationTerminatedEvent.getWsItem());
|
||||
|
||||
if(taskComputationTerminatedEvent.getError()!=null){
|
||||
//Exception occurred server-side no output to displaying
|
||||
Window.alert(taskComputationTerminatedEvent.getError().getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//CALLING METHOD ON SYNC COMPLETED TO THE LISTENERS
|
||||
for (TaskCompletedNotificationListner listener : taskEventsListeners) {
|
||||
listener.onTaskComputationCompleted(taskComputationTerminatedEvent.getWsItem());
|
||||
}
|
||||
|
||||
//RETRIEVES A VALID STATUS IF THE OUTPUT IS COMPLETED BUT IT IS CALLED ON FAILED AND CANCELLED STATUS IN ORDER TO REMOVE SERVER SIDE CACHED COMPUATION
|
||||
WsTaskExecutorWidget.wsTaskService.getOutput(taskComputationTerminatedEvent.getTaskExecutionStatus().getTaskConfiguration(), taskComputationTerminatedEvent.getTaskExecutionStatus().getTaskComputation(), new AsyncCallback<TaskOutput>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
//Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TaskOutput result) {
|
||||
|
||||
if(result==null)
|
||||
return;
|
||||
|
||||
List<String> listMessages = result.getOutputMessages();
|
||||
|
||||
String outMsg = "";
|
||||
for (String msg : listMessages) {
|
||||
outMsg+="<br>"+msg;
|
||||
}
|
||||
|
||||
|
||||
final DialogResult dResult = new DialogResult(null, "Output are:", outMsg);
|
||||
dResult.center();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -262,7 +323,7 @@ public class WsTaskExecutorWidget {
|
|||
throw new Exception("Invalid parameter the configuration is null");
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
box.setTitle("Executing task configuration...");
|
||||
box.setTitle("Executing task...");
|
||||
|
||||
String algName = conf.getTaskId().substring(conf.getTaskId().lastIndexOf(".")+1, conf.getTaskId().length());
|
||||
LoaderIcon loader = new LoaderIcon("Inizializing new run for: "+algName);
|
||||
|
@ -280,7 +341,7 @@ public class WsTaskExecutorWidget {
|
|||
@Override
|
||||
public void onSuccess(TaskExecutionStatus result) {
|
||||
box.hide();
|
||||
viewManager.showMonitorTaskStatusFor(wsItem, result.getTaskConfiguration(), result.getTaskComputation(), taskEventsListeners);
|
||||
viewManager.showMonitorTaskStatusFor(wsItem, result.getTaskConfiguration(), result.getTaskComputation());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -304,7 +365,7 @@ public class WsTaskExecutorWidget {
|
|||
//SHOWING CURRENT ACTIVE MONITOR
|
||||
if(monitor!=null) {
|
||||
GWT.log("Monitor for workpace item: "+wsItem.getItemId() +" exists showing it..");
|
||||
viewManager.showMonitorTaskStatusFor(wsItem, monitor.getTaskConfiguration(), monitor.getTaskComputation(), taskEventsListeners);
|
||||
viewManager.showMonitorTaskStatusFor(wsItem, monitor.getTaskConfiguration(), monitor.getTaskComputation());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,11 @@ public class DialogResult extends DialogBox implements ClickHandler {
|
|||
closeButton = new Button("Close", this);
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
dock.add(new HTML(msg), DockPanel.CENTER);
|
||||
//dock.getElement().getStyle().setProperty("overflowY", "scroll");
|
||||
//vp.getElement().getStyle().setProperty("overflowY", "scroll");
|
||||
HTML htmlMsg = new HTML(msg);
|
||||
//htmlMsg.getElement().getStyle().setProperty("overflowY", "scroll");
|
||||
dock.add(htmlMsg, DockPanel.CENTER);
|
||||
|
||||
dock.add(closeButton, DockPanel.SOUTH);
|
||||
if(img!=null)
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class TaskComputationFinishedEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* Jun 7, 2018
|
||||
*/
|
||||
public class TaskComputationFinishedEvent extends GwtEvent<TaskComputationFinishedEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<TaskComputationFinishedEventHandler> TYPE = new Type<TaskComputationFinishedEventHandler>();
|
||||
private TaskExecutionStatus taskExecutionStatus;
|
||||
private WSItem wsItem;
|
||||
private Throwable error;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new perform run task event.
|
||||
*
|
||||
* @param wsItem the ws item
|
||||
* @param taskExecutionStatus the task execution status
|
||||
*/
|
||||
public TaskComputationFinishedEvent(WSItem wsItem, TaskExecutionStatus taskExecutionStatus, Throwable exception) {
|
||||
this.wsItem = wsItem;
|
||||
this.taskExecutionStatus = taskExecutionStatus;
|
||||
this.error = exception;
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<TaskComputationFinishedEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(TaskComputationFinishedEventHandler handler) {
|
||||
handler.onTaskFinished(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the task execution status.
|
||||
*
|
||||
* @return the taskExecutionStatus
|
||||
*/
|
||||
public TaskExecutionStatus getTaskExecutionStatus() {
|
||||
|
||||
return taskExecutionStatus;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the ws item.
|
||||
*
|
||||
* @return the ws item
|
||||
*/
|
||||
public WSItem getWsItem() {
|
||||
return wsItem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the error
|
||||
*/
|
||||
public Throwable getError() {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Interface TaskComputationFinishedEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* Jun 7, 2018
|
||||
*/
|
||||
public interface TaskComputationFinishedEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On task finished.
|
||||
*
|
||||
* @param taskComputationTerminatedEvent the task computation terminated event
|
||||
*/
|
||||
void onTaskFinished(
|
||||
TaskComputationFinishedEvent taskComputationTerminatedEvent);
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.rpc;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOperator;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOutput;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
|
@ -123,4 +124,18 @@ public interface WsTaskExecutorWidgetService extends RemoteService {
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
List<TaskOperator> getListOperatorsPerScope(String scope) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the output.
|
||||
*
|
||||
* @param taskConfiguration the task configuration
|
||||
* @param taskComputation the task computation
|
||||
* @return the output
|
||||
* @throws TaskErrorException the task error exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
TaskOutput getOutput(
|
||||
TaskConfiguration taskConfiguration, TaskComputation taskComputation)
|
||||
throws TaskErrorException, Exception;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.rpc;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOperator;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOutput;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
|
||||
|
@ -143,9 +144,20 @@ public interface WsTaskExecutorWidgetServiceAsync {
|
|||
* @param scope the scope
|
||||
* @param asyncCallback the async callback
|
||||
* @return the list operators per scope
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
void getListOperatorsPerScope(String scope, AsyncCallback<List<TaskOperator>> asyncCallback);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the output.
|
||||
*
|
||||
* @param taskConfiguration the task configuration
|
||||
* @param taskComputation the task computation
|
||||
* @param asyncCallback the async callback
|
||||
* @return the output
|
||||
*/
|
||||
void getOutput(
|
||||
TaskConfiguration taskConfiguration, TaskComputation taskComputation, AsyncCallback<TaskOutput> asyncCallback);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotificatio
|
|||
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreatedTaskConfigurationEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.event.TaskComputationFinishedEvent;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.AbstractViewDialogBox;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.CreateTaskConfigurationView;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.MonitorFolderTaskExecutionStatusView;
|
||||
|
@ -24,7 +25,6 @@ import com.github.gwtbootstrap.client.ui.event.HideHandler;
|
|||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
|
@ -102,29 +102,26 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show monitor task status for.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param wsItem the ws item
|
||||
* @param configuration the configuration
|
||||
* @param taskComputation the task computation
|
||||
* @param taskEventsListeners the task events listeners
|
||||
*/
|
||||
public void showMonitorTaskStatusFor(
|
||||
final WSItem folder,
|
||||
final TaskConfiguration configuration, final TaskComputation taskComputation, final List<TaskCompletedNotificationListner> taskEventsListeners) {
|
||||
final WSItem wsItem,
|
||||
final TaskConfiguration configuration, final TaskComputation taskComputation) {
|
||||
|
||||
GWT.log("Show Monitor TaskStatus for itemId: "+folder.getItemId());
|
||||
GWT.log("Show Monitor TaskStatus for itemId: "+wsItem.getItemId());
|
||||
|
||||
final Modal box = new Modal(true);
|
||||
box.addStyleName("ws-task-modal-body");
|
||||
box.setTitle("Monitor Task Execution on: "+FormatUtil.getFolderTitle(folder.getItemName(), 20));
|
||||
box.setTitle("Monitor Task Execution on: "+FormatUtil.getFolderTitle(wsItem.getItemName(), 20));
|
||||
box.setWidth(800);
|
||||
box.hide(false);
|
||||
|
||||
MonitorFolderTaskExecutionStatusView monitorView = getMonitor(folder);
|
||||
MonitorFolderTaskExecutionStatusView monitorView = getMonitor(wsItem);
|
||||
GWT.log("monitorView is: "+monitorView);
|
||||
|
||||
final AbstractViewDialogBox panelView = new AbstractViewDialogBox() {
|
||||
|
@ -179,13 +176,13 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
cancelMonitor(folder);
|
||||
Window.alert(caught.getMessage());
|
||||
//cancelMonitor(wsItem);
|
||||
WsTaskExecutorWidget.eventBus.fireEvent(new TaskComputationFinishedEvent(wsItem, null, caught));
|
||||
|
||||
//CALLING METHOD ON SYNC ERROR TO THE LISTENERS
|
||||
for (TaskCompletedNotificationListner listener : taskEventsListeners) {
|
||||
listener.onTaskComputationError(folder);
|
||||
}
|
||||
// //CALLING METHOD ON SYNC ERROR TO THE LISTENERS
|
||||
// for (TaskCompletedNotificationListner listener : taskEventsListeners) {
|
||||
// listener.onTaskComputationError(wsItem);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -193,21 +190,27 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
GWT.log("monitorSyncStatus: "+status);
|
||||
if(status==null) {
|
||||
GWT.log("The status is null server-side, cancelling polling");
|
||||
cancelMonitor(folder);
|
||||
cancelMonitor(wsItem);
|
||||
}
|
||||
|
||||
currentMonitor.updateStatusView(folder, status);
|
||||
currentMonitor.updateStatusView(wsItem, status);
|
||||
|
||||
if(status!=null) {
|
||||
|
||||
if(status.getStatus().equals(TaskStatus.COMPLETED)) {
|
||||
GWT.log("Sync completed cancel the polling: "+status);
|
||||
cancelMonitor(folder);
|
||||
if(status.getStatus().equals(TaskStatus.CANCELLED) ||
|
||||
status.getStatus().equals(TaskStatus.COMPLETED) ||
|
||||
status.getStatus().equals(TaskStatus.FAILED)){
|
||||
|
||||
//CALLING METHOD ON SYNC COMPLETED TO THE LISTENERS
|
||||
for (TaskCompletedNotificationListner listener : taskEventsListeners) {
|
||||
listener.onTaskComputationCompleted(folder);
|
||||
}
|
||||
WsTaskExecutorWidget.eventBus.fireEvent(new TaskComputationFinishedEvent(wsItem, status, null));
|
||||
|
||||
|
||||
// GWT.log("Sync completed cancel the polling: "+status);
|
||||
// cancelMonitor(wsItem);
|
||||
//
|
||||
// //CALLING METHOD ON SYNC COMPLETED TO THE LISTENERS
|
||||
// for (TaskCompletedNotificationListner listener : taskEventsListeners) {
|
||||
// listener.onTaskComputationCompleted(wsItem);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -218,7 +221,7 @@ public class WsTaskExecutorWidgetViewManager {
|
|||
|
||||
schedulingTimer.scheduleRepeating(2000);
|
||||
currentMonitor.setScheduler(schedulingTimer);
|
||||
saveMonitor(folder, currentMonitor);
|
||||
saveMonitor(wsItem, currentMonitor);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,6 @@ public abstract class MonitorFolderTaskExecutionStatusView extends Composite {
|
|||
msgHistory += storageUtil.getItem(KEY_LOCAL_STORAGE_COMP_MSG_HISTORY); //adding also history
|
||||
this.field_history_messages.setValue(msgHistory);
|
||||
storageUtil.setItem(KEY_LOCAL_STORAGE_COMP_MSG_HISTORY, msgHistory);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,8 +79,10 @@ table.table-fixed td {
|
|||
box-shadow: none;
|
||||
/* line-height: 7px; */
|
||||
opacity: 1;
|
||||
z-index: 1500;
|
||||
z-index: 10000;
|
||||
background-color: #FFFFFF;
|
||||
max-height: 700px;
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
.gwt-DialogBoxNew .Caption {
|
||||
|
@ -95,7 +97,9 @@ table.table-fixed td {
|
|||
}
|
||||
|
||||
.gwt-DialogBoxNew .dialogContent {
|
||||
|
||||
max-height: 650px;
|
||||
overflow: hidden;
|
||||
overflow-y: auto !important;
|
||||
}
|
||||
|
||||
.gwt-DialogBoxNew .dialogMiddleCenter {
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.common.portal.PortalContext;
|
|||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.workspacetaskexecutor.dataminer.WorkspaceDataMinerTaskExecutor;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOperator;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskOutput;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType;
|
||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||
|
@ -308,6 +309,18 @@ public class WsTaskExecutorWidgetServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetService#monitorTaskExecutionStatus(org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration, org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation)
|
||||
*/
|
||||
@Override
|
||||
public TaskOutput getOutput(
|
||||
TaskConfiguration taskConfiguration, TaskComputation taskComputation)
|
||||
throws TaskErrorException, Exception{
|
||||
WorkspaceDataMinerTaskExecutor exec = getTaskExecutor();
|
||||
return exec.getTaskOutput(taskConfiguration, taskComputation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list operators per scope.
|
||||
|
|
Loading…
Reference in New Issue