git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@167513 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-05-16 12:33:14 +00:00
parent 0c9b10a1c2
commit 488d3ce0e5
2 changed files with 23 additions and 24 deletions

View File

@ -111,7 +111,7 @@ public class DataMinerAccessPoint {
SClient sClient; SClient sClient;
try { try {
sClient = dataMinerService.getClient(); sClient = dataMinerService.getClient();
sClient.cancelComputation(Converter.toComputationId(task.getComputationId())); sClient.cancelComputation(Converter.toComputationId(task.getTaskComputation()));
} }
catch (Exception e) { catch (Exception e) {
String error = "Error on get Client or the Operator for id: "+taskConfiguration.getTaskId(); String error = "Error on get Client or the Operator for id: "+taskConfiguration.getTaskId();
@ -153,7 +153,7 @@ public class DataMinerAccessPoint {
logger.debug("Start Computation"); logger.debug("Start Computation");
ComputationId computationId = sClient.startComputation(operator); ComputationId computationId = sClient.startComputation(operator);
logger.debug("Started ComputationId: " + computationId); logger.debug("Started ComputationId: " + computationId);
return getTaskStatus(taskConfiguration, Converter.toDMComputationId(computationId)); return getTaskStatus(taskConfiguration, Converter.toDMComputationId(computationId));
} }
catch (Exception e) { catch (Exception e) {

View File

@ -10,22 +10,21 @@ import org.gcube.common.workspacetaskexecutor.shared.TaskStatus;
/** /**
* The Class TaskExecutionStatus. * The Class TaskExecutionStatus.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* May 3, 2018 * May 16, 2018
*/ */
public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializable { public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 6733806455721902864L; private static final long serialVersionUID = 4801536252236521384L;
private Long errorCount; private Long errorCount;
private TaskStatus status; private TaskStatus status;
private Float percentCompleted = new Float(0); private Float percentCompleted = new Float(0);
private String log; private String log;
private String currentMessage="Waiting to start.."; private String currentMessage="Waiting to start..";
private TaskComputation computationId; private TaskComputation taskComputation;
private BaseTaskConfiguration taskConfiguration; private BaseTaskConfiguration taskConfiguration;
@ -40,14 +39,15 @@ public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializabl
* Instantiates a new task execution status. * Instantiates a new task execution status.
* *
* @param taskConfiguration the task configuration * @param taskConfiguration the task configuration
* @param computationId the computation id * @param taskComputation the task computation
*/ */
public TaskExecutionStatus(BaseTaskConfiguration taskConfiguration, TaskComputation computationId) { public TaskExecutionStatus(BaseTaskConfiguration taskConfiguration, TaskComputation taskComputation) {
this.taskConfiguration = taskConfiguration; this.taskConfiguration = taskConfiguration;
this.computationId = computationId; this.taskComputation = taskComputation;
} }
/** /**
* Instantiates a new task execution status. * Instantiates a new task execution status.
* *
@ -56,40 +56,41 @@ public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializabl
* @param percentCompleted the percent completed * @param percentCompleted the percent completed
* @param log the log * @param log the log
* @param currentMessage the current message * @param currentMessage the current message
* @param taskComputation the task computation
* @param taskConfiguration the task configuration * @param taskConfiguration the task configuration
*/ */
public TaskExecutionStatus( public TaskExecutionStatus(
Long errorCount, TaskStatus status, Float percentCompleted, String log, Long errorCount, TaskStatus status, Float percentCompleted, String log,
String currentMessage, TaskConfiguration taskConfiguration) { String currentMessage, TaskComputation taskComputation, TaskConfiguration taskConfiguration) {
this.errorCount = errorCount; this.errorCount = errorCount;
this.status = status; this.status = status;
this.percentCompleted = percentCompleted; this.percentCompleted = percentCompleted;
this.log = log; this.log = log;
this.currentMessage = currentMessage; this.currentMessage = currentMessage;
this.taskComputation = taskComputation;
this.taskConfiguration = taskConfiguration; this.taskConfiguration = taskConfiguration;
} }
/** /**
* Gets the computation id. * Gets the task computation.
* *
* @return the computationId * @return the task computation
*/ */
public TaskComputation getComputationId() { public TaskComputation getTaskComputation() {
return computationId; return taskComputation;
} }
/** /**
* Sets the computation id. * Sets the task computation.
* *
* @param computationId the computationId to set * @param computationId the new task computation
*/ */
public void setComputationId(TaskComputation computationId) { public void setTaskComputation(TaskComputation computationId) {
this.computationId = computationId; this.taskComputation = computationId;
} }
@ -216,14 +217,12 @@ public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializabl
builder.append(log); builder.append(log);
builder.append(", currentMessage="); builder.append(", currentMessage=");
builder.append(currentMessage); builder.append(currentMessage);
builder.append(", computationId="); builder.append(", taskComputation=");
builder.append(computationId); builder.append(taskComputation);
builder.append(", taskConfiguration="); builder.append(", taskConfiguration=");
builder.append(taskConfiguration); builder.append(taskConfiguration);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }