git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@168966 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0ca4b15c3d
commit
7535dafa6e
|
@ -310,34 +310,46 @@ public class DataMinerAccessPoint {
|
||||||
*/
|
*/
|
||||||
public TaskOutput getOutput(TaskConfiguration taskConfiguration, TaskComputation taskComputation) throws TaskErrorException, TaskNotExecutableException {
|
public TaskOutput getOutput(TaskConfiguration taskConfiguration, TaskComputation taskComputation) throws TaskErrorException, TaskNotExecutableException {
|
||||||
|
|
||||||
TaskExecutionStatus tes = monitorStatus(taskConfiguration, taskComputation);
|
TaskExecutionStatus tes = null;
|
||||||
|
|
||||||
SClient sClient;
|
try{
|
||||||
ComputationId computationId = DMConverter.toComputationId(taskComputation);
|
|
||||||
try {
|
tes = monitorStatus(taskConfiguration, taskComputation);
|
||||||
String token = EncrypterUtil.decryptString(taskConfiguration.getMaskedToken());
|
|
||||||
sClient = dataMinerService.getClient(token);
|
SClient sClient;
|
||||||
|
ComputationId computationId = DMConverter.toComputationId(taskComputation);
|
||||||
|
try {
|
||||||
|
String token = EncrypterUtil.decryptString(taskConfiguration.getMaskedToken());
|
||||||
|
sClient = dataMinerService.getClient(token);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
logger.error("Error on get DM client", e);
|
||||||
|
throw new TaskErrorException("Error on getting DataMiner client, Try later");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> outputMessages = retrieveOutput(computationId, sClient);
|
||||||
|
|
||||||
|
//REMOVING THE TASK FROM MEMORY
|
||||||
|
switch (tes.getStatus()) {
|
||||||
|
case COMPLETED:
|
||||||
|
case CANCELLED:
|
||||||
|
case FAILED:
|
||||||
|
logger.info("Removing "+tes+ "from memory");
|
||||||
|
removeTaskFromMemory(tes.getTaskConfiguration());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new TaskOutput(tes, outputMessages);
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
if(tes!=null)
|
||||||
|
removeTaskFromMemory(tes.getTaskConfiguration());
|
||||||
|
|
||||||
|
logger.error("Get output error: ",e);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
|
||||||
logger.error("Error on get DM client", e);
|
|
||||||
throw new TaskErrorException("Error on getting DataMiner client, Try later");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> outputMessages = retrieveOutput(computationId, sClient);
|
|
||||||
|
|
||||||
//REMOVING THE TASK FROM MEMORY
|
|
||||||
switch (tes.getStatus()) {
|
|
||||||
case COMPLETED:
|
|
||||||
case CANCELLED:
|
|
||||||
case FAILED:
|
|
||||||
logger.info("Removing "+tes+ "from memory");
|
|
||||||
removeTaskFromMemory(tes.getTaskConfiguration());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TaskOutput(tes, outputMessages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue