231 lines
4.7 KiB
Java
231 lines
4.7 KiB
Java
package org.gcube.common.workspacetaskexecutor.shared.dataminer;
|
|
|
|
import java.io.Serializable;
|
|
|
|
import org.gcube.common.workspacetaskexecutor.shared.BaseTaskConfiguration;
|
|
import org.gcube.common.workspacetaskexecutor.shared.BaseTaskExecutionStatus;
|
|
import org.gcube.common.workspacetaskexecutor.shared.Status;
|
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
|
|
|
|
|
/**
|
|
* The Class TaskExecutionStatus.
|
|
*
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
* May 3, 2018
|
|
*/
|
|
public class TaskExecutionStatus implements BaseTaskExecutionStatus, Serializable {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 6733806455721902864L;
|
|
|
|
private Long errorCount;
|
|
private Status status;
|
|
private Float percentCompleted = new Float(0);
|
|
private String log;
|
|
private String currentMessage="Waiting to start..";
|
|
private ComputationId computationId;
|
|
private BaseTaskConfiguration taskConfiguration;
|
|
|
|
|
|
/**
|
|
* Instantiates a new task execution status.
|
|
*/
|
|
public TaskExecutionStatus() {
|
|
}
|
|
|
|
|
|
/**
|
|
* Instantiates a new task execution status.
|
|
*
|
|
* @param taskConfiguration the task configuration
|
|
* @param computationId the computation id
|
|
*/
|
|
public TaskExecutionStatus(BaseTaskConfiguration taskConfiguration, ComputationId computationId) {
|
|
this.taskConfiguration = taskConfiguration;
|
|
this.computationId = computationId;
|
|
}
|
|
|
|
|
|
/**
|
|
* Instantiates a new task execution status.
|
|
*
|
|
* @param errorCount the error count
|
|
* @param status the status
|
|
* @param percentCompleted the percent completed
|
|
* @param log the log
|
|
* @param currentMessage the current message
|
|
* @param taskConfiguration the task configuration
|
|
*/
|
|
public TaskExecutionStatus(
|
|
Long errorCount, Status status, Float percentCompleted, String log,
|
|
String currentMessage, TaskConfiguration taskConfiguration) {
|
|
this.errorCount = errorCount;
|
|
this.status = status;
|
|
this.percentCompleted = percentCompleted;
|
|
this.log = log;
|
|
this.currentMessage = currentMessage;
|
|
this.taskConfiguration = taskConfiguration;
|
|
}
|
|
|
|
|
|
/**
|
|
* Gets the computation id.
|
|
*
|
|
* @return the computationId
|
|
*/
|
|
public ComputationId getComputationId() {
|
|
|
|
return computationId;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* Sets the computation id.
|
|
*
|
|
* @param computationId the computationId to set
|
|
*/
|
|
public void setComputationId(ComputationId computationId) {
|
|
|
|
this.computationId = computationId;
|
|
}
|
|
|
|
|
|
/**
|
|
* Gets the error count.
|
|
*
|
|
* @return the error count
|
|
*/
|
|
public Long getErrorCount() {
|
|
return errorCount;
|
|
}
|
|
|
|
/**
|
|
* Sets the error count.
|
|
*
|
|
* @param errorCount the new error count
|
|
*/
|
|
public void setErrorCount(Long errorCount) {
|
|
this.errorCount = errorCount;
|
|
}
|
|
|
|
/**
|
|
* Gets the status.
|
|
*
|
|
* @return the status
|
|
*/
|
|
public Status getStatus() {
|
|
return status;
|
|
}
|
|
|
|
/**
|
|
* Sets the status.
|
|
*
|
|
* @param status the new status
|
|
*/
|
|
public void setStatus(Status status) {
|
|
this.status = status;
|
|
}
|
|
|
|
/**
|
|
* Gets the log builder.
|
|
*
|
|
* @return the log builder
|
|
*/
|
|
public String getLog() {
|
|
return log;
|
|
}
|
|
|
|
|
|
/**
|
|
* Adds the log.
|
|
*
|
|
* @param logMessage the log message
|
|
*/
|
|
public void addLog(String logMessage) {
|
|
if(log==null)
|
|
this.log = logMessage;
|
|
else
|
|
log+=logMessage;
|
|
}
|
|
|
|
/**
|
|
* Gets the current message.
|
|
*
|
|
* @return the current message
|
|
*/
|
|
public String getCurrentMessage() {
|
|
return currentMessage;
|
|
}
|
|
|
|
/**
|
|
* Sets the current message.
|
|
*
|
|
* @param currentMessage the new current message
|
|
*/
|
|
public void setCurrentMessage(String currentMessage) {
|
|
this.currentMessage = currentMessage;
|
|
}
|
|
|
|
/**
|
|
* Gets the percent completed.
|
|
*
|
|
* @return the percent completed
|
|
*/
|
|
public Float getPercentCompleted() {
|
|
return percentCompleted;
|
|
}
|
|
|
|
/**
|
|
* Sets the percent completed.
|
|
*
|
|
* @param percentCompleted the new percent completed
|
|
*/
|
|
public void setPercentCompleted(float percentCompleted) {
|
|
this.percentCompleted = percentCompleted;
|
|
}
|
|
|
|
|
|
/**
|
|
* Gets the task configuration.
|
|
*
|
|
* @return the task configuration
|
|
*/
|
|
public BaseTaskConfiguration getTaskConfiguration() {
|
|
|
|
return taskConfiguration;
|
|
}
|
|
|
|
|
|
/* (non-Javadoc)
|
|
* @see java.lang.Object#toString()
|
|
*/
|
|
@Override
|
|
public String toString() {
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
builder.append("TaskExecutionStatus [errorCount=");
|
|
builder.append(errorCount);
|
|
builder.append(", status=");
|
|
builder.append(status);
|
|
builder.append(", percentCompleted=");
|
|
builder.append(percentCompleted);
|
|
builder.append(", log=");
|
|
builder.append(log);
|
|
builder.append(", currentMessage=");
|
|
builder.append(currentMessage);
|
|
builder.append(", computationId=");
|
|
builder.append(computationId);
|
|
builder.append(", taskConfiguration=");
|
|
builder.append(taskConfiguration);
|
|
builder.append("]");
|
|
return builder.toString();
|
|
}
|
|
|
|
|
|
|
|
}
|