ref 16155: Enact DM Model Executor to automatically run a dataminer algorithm
https://support.d4science.org/issues/16155 Added automatic run git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-executor@178566 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d7117f912e
commit
5ac7dc2039
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/data-miner-executor-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/data-miner-executor-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -34,5 +34,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/data-miner-executor-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="data-miner-executor-1.0.0-SNAPSHOT">
|
||||
<wb-module deploy-name="data-miner-executor-1.1.0-SNAPSHOT">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="data-miner-manager-cl-1.6.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/data-miner-manager-cl/data-miner-manager-cl">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/data-miner-manager/target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<property name="context-root" value="data-miner-executor"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="${groupId}.${artifactId}.1-1-0" date="2019-03-13">
|
||||
<Change>Added automatic run [ticket #16155]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="${groupId}.${artifactId}.1-0-0" date="2019-01-31">
|
||||
<Change>First release</Change>
|
||||
</Changeset>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>data-miner-executor</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>data-miner-executor</name>
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.portlets.user.dataminerexecutor.client;
|
|||
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.events.CancelComputationExecutionRequestEvent;
|
||||
|
@ -29,6 +28,7 @@ import org.gcube.portlets.user.dataminerexecutor.client.util.InfoMessageBox;
|
|||
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.Constants;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.session.UserInfo;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
@ -381,7 +381,7 @@ public class DataMinerExecutorController {
|
|||
messageBox.show();
|
||||
|
||||
DataMinerExecutorServiceAsync.INSTANCE.getInvocationModel(invocationModelFileUrl,
|
||||
new AsyncCallback<Operator>() {
|
||||
new AsyncCallback<InvocationModel>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -401,10 +401,10 @@ public class DataMinerExecutorController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Operator operator) {
|
||||
public void onSuccess(InvocationModel invocationModel) {
|
||||
messageBox.hide();
|
||||
Log.debug("Invocation Retrieved: " + operator);
|
||||
InvocationModelEvent event = new InvocationModelEvent(operator);
|
||||
Log.debug("Invocation Retrieved: " + invocationModel);
|
||||
InvocationModelEvent event = new InvocationModelEvent(invocationModel);
|
||||
Log.debug("Fire: " + event);
|
||||
EventBusProvider.INSTANCE.fireEvent(event);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.user.dataminerexecutor.client.events;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
@ -15,24 +15,21 @@ import com.google.gwt.event.shared.HasHandlers;
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class InvocationModelEvent
|
||||
extends GwtEvent<InvocationModelEvent.InvocationModelEventHandler> {
|
||||
public class InvocationModelEvent extends GwtEvent<InvocationModelEvent.InvocationModelEventHandler> {
|
||||
|
||||
public static Type<InvocationModelEventHandler> TYPE = new Type<InvocationModelEventHandler>();
|
||||
private Operator operator;
|
||||
private InvocationModel invocationModel;
|
||||
|
||||
public interface InvocationModelEventHandler extends EventHandler {
|
||||
void onInvocation(InvocationModelEvent event);
|
||||
}
|
||||
|
||||
public interface HasInvocationModelEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addInvocationModelEventHandler(
|
||||
InvocationModelEventHandler handler);
|
||||
public HandlerRegistration addInvocationModelEventHandler(InvocationModelEventHandler handler);
|
||||
}
|
||||
|
||||
|
||||
public InvocationModelEvent(Operator operator) {
|
||||
this.operator=operator;
|
||||
public InvocationModelEvent(InvocationModel invocationModel) {
|
||||
this.invocationModel = invocationModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,14 +50,13 @@ public class InvocationModelEvent
|
|||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public Operator getOperator() {
|
||||
return operator;
|
||||
public InvocationModel getInvocationModel() {
|
||||
return invocationModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InvocationModelEvent [operator=" + operator + "]";
|
||||
return "InvocationModelEvent [invocationModel=" + invocationModel + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyE
|
|||
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent.ComputationReadyEventHandler;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent.HasComputationReadyEventHandler;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.experiments.ComputationParametersPanel.ComputationParametersPanelHandler;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
@ -131,8 +132,40 @@ public class ComputationPanel extends FramedPanel implements HasComputationReady
|
|||
|
||||
}
|
||||
|
||||
public void addOperator(Operator operator) {
|
||||
computationParametersPanel = new ComputationParametersPanel(operator);
|
||||
public void addInvocation(InvocationModel invocationModel) {
|
||||
computationParametersPanel = new ComputationParametersPanel(invocationModel.getOperator());
|
||||
if(invocationModel.getInvocationAction()==null){
|
||||
setReadyHandler();
|
||||
} else {
|
||||
switch(invocationModel.getInvocationAction()){
|
||||
case EDIT:
|
||||
setReadyHandler();
|
||||
break;
|
||||
case RUN:
|
||||
automaticRun();
|
||||
break;
|
||||
case SHOW:
|
||||
setReadyHandler();
|
||||
break;
|
||||
default:
|
||||
setReadyHandler();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void automaticRun() {
|
||||
addComputationParametersPanel(computationParametersPanel);
|
||||
forceLayout();
|
||||
Operator op = computationParametersPanel.getOperator();
|
||||
ComputationReadyEvent event = new ComputationReadyEvent(op);
|
||||
fireEvent(event);
|
||||
}
|
||||
|
||||
|
||||
private void setReadyHandler(){
|
||||
computationParametersPanel.setHandler(new ComputationParametersPanelHandler() {
|
||||
@Override
|
||||
public void startComputation() {
|
||||
|
@ -147,7 +180,6 @@ public class ComputationPanel extends FramedPanel implements HasComputationReady
|
|||
});
|
||||
|
||||
addComputationParametersPanel(computationParametersPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelEvent;
|
||||
//import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelRequestEvent;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
|
@ -45,7 +45,7 @@ public class ExperimentPanel extends SimpleContainer {
|
|||
@Override
|
||||
public void onInvocation(InvocationModelEvent event) {
|
||||
Log.debug("Catch InvocationModelEvent: " + event);
|
||||
addOperator(event.getOperator());
|
||||
addInvocation(event.getInvocationModel());
|
||||
|
||||
}
|
||||
|
||||
|
@ -76,13 +76,13 @@ public class ExperimentPanel extends SimpleContainer {
|
|||
*
|
||||
*/
|
||||
|
||||
private void addOperator(Operator operator) {
|
||||
private void addInvocation(InvocationModel invocationModel) {
|
||||
//if (lastOperatorSelected != null
|
||||
// && lastOperatorSelected != operatorPanel)
|
||||
// lastOperatorSelected.toggleSelected(false);
|
||||
//if (lastOperatorSelected != operatorPanel)
|
||||
// operatorPanel.toggleSelected(true);
|
||||
//lastOperatorSelected = operatorPanel;
|
||||
workflowPanel.addOperator(operator);
|
||||
workflowPanel.addInvocation(invocationModel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
|
|||
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.events.ResubmitComputationExecutionEvent;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
||||
|
@ -104,9 +105,9 @@ public class WorkflowPanel extends TabPanel {
|
|||
|
||||
}
|
||||
|
||||
public void addOperator(Operator op) {
|
||||
public void addInvocation(InvocationModel invocationModel) {
|
||||
setActiveWidget(computationPanel);
|
||||
computationPanel.addOperator(op);
|
||||
computationPanel.addInvocation(invocationModel);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassi
|
|||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.session.UserInfo;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
@ -54,6 +55,6 @@ public interface DataMinerExecutorService extends RemoteService {
|
|||
|
||||
public ItemDescription getItemDescription(String itemId) throws ServiceException;
|
||||
|
||||
public Operator getInvocationModel(String invocationModelFileUrl) throws ServiceException;
|
||||
public InvocationModel getInvocationModel(String invocationModelFileUrl) throws ServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
|||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.session.UserInfo;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -58,6 +59,6 @@ public interface DataMinerExecutorServiceAsync {
|
|||
|
||||
void getItemDescription(String itemId, AsyncCallback<ItemDescription> asyncCallback);
|
||||
|
||||
void getInvocationModel(String invocationModelFileUrl, AsyncCallback<Operator> callback);
|
||||
void getInvocationModel(String invocationModelFileUrl, AsyncCallback<InvocationModel> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
|||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.DataMinerWorkArea;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
|
||||
import org.gcube.data.analysis.dminvocation.ActionType;
|
||||
import org.gcube.data.analysis.dminvocation.model.DataMinerInvocation;
|
||||
import org.gcube.data.analysis.dminvocation.model.DataMinerParam;
|
||||
import org.gcube.portlets.user.dataminerexecutor.client.rpc.DataMinerExecutorService;
|
||||
|
@ -27,6 +28,8 @@ import org.gcube.portlets.user.dataminerexecutor.server.storage.StorageUtil;
|
|||
import org.gcube.portlets.user.dataminerexecutor.server.util.DataMinerWorkAreaManager;
|
||||
import org.gcube.portlets.user.dataminerexecutor.server.util.TableReader;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.exception.ServiceException;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationAction;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.process.InvocationModel;
|
||||
import org.gcube.portlets.user.dataminerexecutor.shared.session.UserInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -118,7 +121,7 @@ public class DataMinerExecutorServiceImpl extends RemoteServiceServlet implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public Operator getInvocationModel(String invocationModelFileUrl) throws ServiceException {
|
||||
public InvocationModel getInvocationModel(String invocationModelFileUrl) throws ServiceException {
|
||||
try {
|
||||
HttpServletRequest httpRequest = this.getThreadLocalRequest();
|
||||
ServiceCredentials serviceCredentials = SessionUtil.getServiceCredentials(httpRequest);
|
||||
|
@ -132,6 +135,26 @@ public class DataMinerExecutorServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
}
|
||||
|
||||
InvocationAction invocationAction;
|
||||
ActionType actionType=dmInvocation.getActionType();
|
||||
if(actionType==null){
|
||||
invocationAction=InvocationAction.SHOW;
|
||||
} else {
|
||||
switch(actionType){
|
||||
case EDIT:
|
||||
invocationAction=InvocationAction.SHOW;
|
||||
break;
|
||||
case RUN:
|
||||
invocationAction=InvocationAction.RUN;
|
||||
break;
|
||||
default:
|
||||
invocationAction=InvocationAction.SHOW;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (dmInvocation.getParameters() == null || dmInvocation.getParameters().getInput() == null
|
||||
|| dmInvocation.getParameters().getInput().getListParam() == null
|
||||
|| dmInvocation.getParameters().getInput().getListParam().isEmpty()) {
|
||||
|
@ -178,7 +201,10 @@ public class DataMinerExecutorServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
operator.setOperatorParameters(inputParametersFilled);
|
||||
|
||||
return operator;
|
||||
InvocationModel invocationModel=new InvocationModel(invocationAction,operator);
|
||||
|
||||
|
||||
return invocationModel;
|
||||
} catch (ServiceException e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
throw e;
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package org.gcube.portlets.user.dataminerexecutor.shared.process;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum InvocationAction {
|
||||
|
||||
SHOW("show"),
|
||||
EDIT("edit"),
|
||||
RUN("run");
|
||||
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* Instantiates a new action type.
|
||||
*
|
||||
* @param action the action
|
||||
*/
|
||||
InvocationAction(String action){
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the action.
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
public String getAction() {
|
||||
|
||||
return action;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.user.dataminerexecutor.shared.process;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class InvocationModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6912479380989389840L;
|
||||
private InvocationAction invocationAction;
|
||||
private Operator operator;
|
||||
|
||||
public InvocationModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public InvocationModel(InvocationAction invocationAction, Operator operator) {
|
||||
super();
|
||||
this.operator = operator;
|
||||
this.invocationAction = invocationAction;
|
||||
}
|
||||
|
||||
public Operator getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setOperator(Operator operator) {
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
public InvocationAction getInvocationAction() {
|
||||
return invocationAction;
|
||||
}
|
||||
|
||||
public void setInvocationAction(InvocationAction invocationAction) {
|
||||
this.invocationAction = invocationAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InvocationModel [invocationAction=" + invocationAction + ", operator=" + operator + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue