Commit 6f8d72eb authored by rosemaryng's avatar rosemaryng
Browse files

[Clean up] Removed print messages and created new remove event in JonInfoList for response time bug

parent e1a1bcce
......@@ -122,12 +122,8 @@ public class Queue extends InputSection {
private JobInfoList FJList;
// Backup buffer when the main jobsList is full
private JobInfoList waitingRequests;
// Retrial group when the main jobsList (primary queue) is full
private Map<Integer, Double> retrialFullGroup = new HashMap<>();
private boolean retryFull = false;
private Retrial retrial;
//number of reneged jobs
private int renegedJobs;
......@@ -390,8 +386,6 @@ public class Queue extends InputSection {
linkedToPSServer = true;
}
retrial = new Retrial(this.getNetSytem(), 0.6);
}
/**
......@@ -478,19 +472,12 @@ public class Queue extends InputSection {
*/
job = message.getJob();
// double randomDelay = retrial.generateRandomDelay();
double randomDelay = retrialDistributionStrategies[job.getJobClass().getId()].wait(this, job.getJobClass());
System.out.println("random delay: " + randomDelay);
double retrialTime = this.getNetSytem().getTime() + randomDelay;
nodeJobsList.addToRetrialOrbit(job);
// System.out.println("Retrial signaled for " + job.getId() + " at " + retrialTime);
// System.out.println("retrialJobsCount: " + retried.size() + " retrials Total Count: " + retrialCount + " retrial group: " + retrialFullGroup.keySet() + " NodeJobsList: " + nodeJobsList.getInternalJobInfoList());
sendMe(NetEvent.EVENT_RETRIAL_JOB, job, randomDelay);
break;
case NetEvent.EVENT_RETRIAL_JOB:
// System.out.println("**** [Retrial] ****");
isRetrialJob = true;
retrialCount++;
......@@ -520,27 +507,16 @@ public class Queue extends InputSection {
job = message.getJob();
JobInfo jobInfo = nodeJobsList.lookFor(job);
// System.out.println("---- " + job.getId() + " time: " + getNetSytem().getTime());
if (isRetrialJob) {
retried.add(job.getId());
nodeJobsList.retryJob(jobInfo);
netJobsList.retryJob(job);
System.out.println("retry");
} else {
System.out.println("job");
}
// System.out.println("----- \n" + jobInfo + " Time now: " + getNetSytem().getTime());
// System.out.println("Current Queue: " + nodeJobsList.getJobsInPrimaryQueue());
// System.out.println("RetrialFullGroup: " + retrialFullGroup);
// System.out.println("NodeJobsList size: " + nodeJobsList.size());
// System.out.println("this job is: " + nodeJobsList.lookFor(job).toString() + " time: " + this.getNetSytem().getTime());
// System.out.println("jobs waiting to be retried: " + retrialFullGroup);
//----REDIRECTION BEHAVIOUR----------//
if (redirectionON) {
NetNode source = message.getSource();
......@@ -589,14 +565,12 @@ public class Queue extends InputSection {
// Queue is not full. Okay.
double waitingTime = getNetSytem().getTime() - job.getSystemEnteringTime();
if (nodeJobsList.getRetrialOrbit().containsKey(job.getId())) {
// System.out.println(job.getId() + " proceeds.");
waitingTime = getNetSytem().getTime() - nodeJobsList.getRetrialOrbit().get(job.getId()).get(0);
nodeJobsList.removeFromRetrialOrbit(job);
// System.out.println("waitingTime for a retrial job: " + waitingTime);
}
nodeJobsList.updateWaitingTime(job, waitingTime);
// System.out.println("retrialJobsCount: " + retried.size() + " retrials Total Count: " + retrialCount + " orbit size: " + nodeJobsList.getRetrialOrbit() + " NodeJobsList: " + nodeJobsList.getInternalJobInfoList());
// If parent node is a fork node adds job to FJ info list
if (getOwnerNode().getSection(NodeSection.OUTPUT) instanceof Fork) {
addJobToBuffer(job, message, BufferType.FJ_LIST);
......@@ -647,20 +621,21 @@ public class Queue extends InputSection {
setRenegingEvent(job);
}
// otherwise if job has been sent by another node
else if (!drop[job.getJobClass().getId()]) { //whether the user select drop
else if (!drop[job.getJobClass().getId()]) { // whether the user select drop
// if drop is true reject the job, else add the job to waitingRequests or retryFull group
// Retry Full route
if (dropStrategies != null && dropStrategies[0].equals(FINITE_RETRIAL)) {
// System.out.println(job.getId() + " full, will be retried. Time now: " + this.getNetSytem().getTime());
sendMe(NetEvent.EVENT_RETRIAL, job, 0);
} else {
addJobToBuffer(job, message, BufferType.WAITING_REQUESTS);
setRenegingEvent(job);
}
// if blocking is disabled, sends ack otherwise router of the previous node remains busy
/*
if blocking is disabled, sends ack otherwise router of the previous node remains busy.
A retrial job has sent the ack before when it tried to join the queue for the first time
*/
if (!block[job.getJobClass().getId()] && !isRetrialJob) {
send(NetEvent.EVENT_ACK, job, 0.0, message.getSourceSection(), message.getSource());
}
......
......@@ -236,6 +236,8 @@ public interface JobInfoList {
*/
public abstract void remove(JobInfo jobInfo);
// public abstract void remove(JobInfo jobInfo, int event);
/**
* Removes a job info at the start of the list.
* @return Job info at the start of the list.
......
......@@ -687,6 +687,22 @@ public class NetNode extends SimEntity {
return false;
}
/**
* Helper function to remove job from the NodeJobsList
* @param data the jobInfo data looking to be removed.
*/
private boolean removeJobFromNodeJobsList(Job data, int event) {
Job job = data;
JobInfo jobInfo = jobsList.lookFor(job);
if (jobInfo != null) {
jobsList.remove(jobInfo, event);
return true;
}
return false;
}
/**
* Unschedules a message given a remove token.
* @param token the token to remove the message.
......
......@@ -136,7 +136,7 @@ public class DispatcherJSIMschema {
public boolean solveModel() throws Exception {
/*********************SIM DEFINITION MODEL*********************/
// does model file exist??
if (!simModelDefinition.exists()) {
if (!simModelDefinition.exists()) {
//the passed file does not exist
logger.error("The sim model file " + simModelDefinitionPath + " does not exist...");
return false;
......
......@@ -3929,7 +3929,6 @@ public class CommonModel implements CommonConstants, ClassDefinition, StationDef
private ImpatienceType impatienceType;
private ImpatienceParameter impatienceParameter;
public Double retrialRate;
// public Retrial retrial;
public Object retrialDistribution;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment