2015-05-28 13:19:25 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.accounting.datamodel.implementations;
|
|
|
|
|
2015-05-29 16:08:21 +02:00
|
|
|
import java.util.Calendar;
|
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
import org.gcube.accounting.datamodel.RawUsageRecord;
|
2015-06-05 11:43:53 +02:00
|
|
|
import org.gcube.accounting.datamodel.annotations.NotEmpty;
|
|
|
|
import org.gcube.accounting.datamodel.annotations.ValidInteger;
|
|
|
|
import org.gcube.accounting.datamodel.annotations.ValidLong;
|
2015-05-29 16:08:21 +02:00
|
|
|
import org.gcube.accounting.exception.InvalidValueException;
|
2015-05-28 13:19:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class TaskUsageRecord extends RawUsageRecord {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generated Serial Version UID
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = -2208425042550641240L;
|
|
|
|
|
2015-05-29 16:08:21 +02:00
|
|
|
public static enum USAGE_PHASE {
|
|
|
|
completed, failed
|
|
|
|
};
|
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
@NotEmpty
|
|
|
|
public static final String JOB_ID = "jobId";
|
|
|
|
@NotEmpty
|
|
|
|
public static final String REF_HOST = "refHost";
|
|
|
|
@NotEmpty
|
|
|
|
public static final String REF_VM = "refVM";
|
|
|
|
@NotEmpty
|
|
|
|
public static final String DOMAIN = "domain";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-29 16:08:21 +02:00
|
|
|
public static final String USAGE_START_TIME = "usageStartTime";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-29 16:08:21 +02:00
|
|
|
public static final String USAGE_END_TIME = "usageEndTime";
|
2015-05-28 13:19:25 +02:00
|
|
|
@NotEmpty
|
|
|
|
public static final String USAGE_PHASE = "usagePhase";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidInteger
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String INPUT_FILES_NUMBER = "inputFilesNumber";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String INPUT_FILES_SIZE = "inputFilesSize";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidInteger
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String OUTPUT_FILES_NUMBER = "outputFilesNumber";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String OUTPUT_FILES_SIZE = "outputFilesSize";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String OVERALL_NETWORK_IN = "overallNetworkIn";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidLong
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String OVERALL_NETWORK_OUT = "overallNetworkOut";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidInteger
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String CORES = "cores";
|
2015-06-03 11:57:38 +02:00
|
|
|
@ValidInteger
|
2015-05-28 13:19:25 +02:00
|
|
|
public static final String PROCESSORS = "processors";
|
|
|
|
|
|
|
|
|
|
|
|
public TaskUsageRecord(){
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
2015-05-29 16:08:21 +02:00
|
|
|
/**
|
|
|
|
* @return the Job Id
|
|
|
|
*/
|
|
|
|
public String getJobId() {
|
|
|
|
return (String) this.resourceSpecificProperties.get(JOB_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param jobId Job Id
|
|
|
|
* @throws InvalidValueException if fails
|
|
|
|
*/
|
|
|
|
public void setJobId(String jobId) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(JOB_ID, jobId);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getRefHost() {
|
|
|
|
return (String) this.resourceSpecificProperties.get(REF_HOST);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRefHost(String refHost) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(REF_HOST, refHost);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getRefVM() {
|
|
|
|
return (String) this.resourceSpecificProperties.get(REF_VM);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRefVM(String refVM) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(REF_VM, refVM);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDomain() {
|
|
|
|
return (String) this.resourceSpecificProperties.get(DOMAIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDomain(String domain) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(DOMAIN, domain);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Calendar getUsageStartTime() {
|
|
|
|
long millis = (Long) this.resourceSpecificProperties.get(USAGE_START_TIME);
|
|
|
|
return timestampStringToCalendar(millis);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsageStartTime(Calendar usageStartTime) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(USAGE_START_TIME, usageStartTime.getTimeInMillis());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public Calendar getUsageEndTime() {
|
|
|
|
long millis = (Long) this.resourceSpecificProperties.get(USAGE_END_TIME);
|
|
|
|
return timestampStringToCalendar(millis);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsageEndTime(Calendar usageEndTime) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(USAGE_END_TIME, usageEndTime.getTimeInMillis());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public USAGE_PHASE getUsagePhase() {
|
|
|
|
return (USAGE_PHASE) this.resourceSpecificProperties.get(USAGE_PHASE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsagePhase(USAGE_PHASE usagePhase) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(USAGE_PHASE, usagePhase);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getInputFilesNumber() {
|
|
|
|
return (Integer) this.resourceSpecificProperties.get(INPUT_FILES_NUMBER);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setInputFilesNumber(int inputFilesNumber) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(INPUT_FILES_NUMBER, inputFilesNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getInputFilesSize() {
|
|
|
|
return (Long) this.resourceSpecificProperties.get(INPUT_FILES_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setInputFilesSize(long inputFilesSize) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(INPUT_FILES_SIZE, inputFilesSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getOutputFilesNumber() {
|
|
|
|
return (Integer) this.resourceSpecificProperties.get(OUTPUT_FILES_NUMBER);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOutputFilesNumber(int outputFilesNumber) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(OUTPUT_FILES_NUMBER, outputFilesNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getOutputFilesSize() {
|
|
|
|
return (Long) this.resourceSpecificProperties.get(OUTPUT_FILES_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOutputFilesSize(long outputFilesSize) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(OUTPUT_FILES_SIZE, outputFilesSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getOverallNetworkIn() {
|
|
|
|
return (Long) this.resourceSpecificProperties.get(OVERALL_NETWORK_IN);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOverallNetworkIn(long overallNetworkIn) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(OVERALL_NETWORK_IN, overallNetworkIn);
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getOverallNetworkOut() {
|
|
|
|
return (Long) this.resourceSpecificProperties.get(OVERALL_NETWORK_OUT);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOverallNetworkOut(long overallNetworkOut) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(OVERALL_NETWORK_OUT, overallNetworkOut);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCores() {
|
|
|
|
return (Integer) this.resourceSpecificProperties.get(CORES);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setCores(int cores) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(CORES, cores);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getProcessors() {
|
|
|
|
return (Integer) this.resourceSpecificProperties.get(PROCESSORS);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setProcessors(int processors) throws InvalidValueException {
|
|
|
|
setResourceSpecificProperty(PROCESSORS, processors);
|
|
|
|
}
|
|
|
|
|
2015-05-28 13:19:25 +02:00
|
|
|
}
|