Enhancement on Project Activity #11690
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@167247 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a570e260db
commit
dca15a6a93
|
@ -62,14 +62,15 @@ public class DataMinerAccessPoint {
|
|||
mapCallBack.put(algConfiguration.hashCode(), taskStatus);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the task.
|
||||
*
|
||||
* @param operatorId the operator id
|
||||
* @param algConfiguration the alg configuration
|
||||
* @return the task
|
||||
*/
|
||||
private TaskExecutionStatus getTask(String operatorId){
|
||||
return mapCallBack.get(operatorId);
|
||||
private TaskExecutionStatus getTask(AlgorithmConfiguration algConfiguration){
|
||||
return mapCallBack.get(algConfiguration.hashCode());
|
||||
|
||||
}
|
||||
|
||||
|
@ -78,9 +79,10 @@ public class DataMinerAccessPoint {
|
|||
* Do run task.
|
||||
*
|
||||
* @param algConfiguration the alg configuration
|
||||
* @return the task execution status
|
||||
* @throws TaskNotExecutableException the task not executable exception
|
||||
*/
|
||||
public void doRunTask(AlgorithmConfiguration algConfiguration) throws TaskNotExecutableException{
|
||||
public TaskExecutionStatus doRunTask(AlgorithmConfiguration algConfiguration) throws TaskNotExecutableException{
|
||||
|
||||
Operator operator;
|
||||
SClient sClient;
|
||||
|
@ -104,12 +106,13 @@ public class DataMinerAccessPoint {
|
|||
logger.debug("Start Computation");
|
||||
ComputationId computationId = sClient.startComputation(operator);
|
||||
logger.debug("Started ComputationId: " + computationId);
|
||||
startComputationOnDataMiner(algConfiguration, computationId, sClient);
|
||||
return startComputationOnDataMiner(algConfiguration, computationId, sClient);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,11 +122,12 @@ public class DataMinerAccessPoint {
|
|||
* @param operatorId the operator id
|
||||
* @return the task execution status
|
||||
*/
|
||||
public TaskExecutionStatus getTaskStatus(String operatorId) {
|
||||
public TaskExecutionStatus getTaskStatus(AlgorithmConfiguration algConfiguration) {
|
||||
|
||||
TaskExecutionStatus task = getTask(operatorId);
|
||||
TaskExecutionStatus task = getTask(algConfiguration);
|
||||
|
||||
if(task==null){
|
||||
//TODO
|
||||
//startComputationOnDM(computationId, sClient);
|
||||
}
|
||||
|
||||
|
@ -152,6 +156,7 @@ public class DataMinerAccessPoint {
|
|||
status.setStatus(Status.ONGOING);
|
||||
status.setPercentCompleted((float) percentage);
|
||||
status.setCurrentMessage("Operation Running...");
|
||||
saveTask(algConfiguration, status);
|
||||
|
||||
}
|
||||
|
||||
|
@ -162,6 +167,7 @@ public class DataMinerAccessPoint {
|
|||
status.setStatus(Status.FAILED);
|
||||
status.setCurrentMessage(message);
|
||||
status.addLog(exception.getMessage());
|
||||
saveTask(algConfiguration, status);
|
||||
|
||||
}
|
||||
|
||||
|
@ -173,6 +179,7 @@ public class DataMinerAccessPoint {
|
|||
status.setStatus(Status.COMPLETED);
|
||||
status.setCurrentMessage("Operation Completed");
|
||||
status.addLog(log);
|
||||
saveTask(algConfiguration, status);
|
||||
|
||||
}
|
||||
|
||||
|
@ -182,6 +189,7 @@ public class DataMinerAccessPoint {
|
|||
status.setStatus(Status.COMPLETED);
|
||||
status.setCurrentMessage("Operation Cancelled");
|
||||
status.addLog("Operation Cancelled");
|
||||
saveTask(algConfiguration, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,7 +198,7 @@ public class DataMinerAccessPoint {
|
|||
status.setStatus(Status.ACCEPTED);
|
||||
status.setCurrentMessage("Operation Accepted");
|
||||
status.addLog("Operation Accepted");
|
||||
|
||||
saveTask(algConfiguration, status);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue