Commit e5f8d698 authored by rosemaryng's avatar rosemaryng
Browse files

[Retry Full] Fixed bug with proceeding with waitingQueue (not supposed to). Job is resent to queue

parent 24ee1127
......@@ -127,7 +127,7 @@ public class Queue extends InputSection {
// Backup buffer when the main jobsList is full
private JobInfoList waitingRequests;
// Retrial group when the main jobsLis (primary queue) is full
private List<Integer> retrialFullGroup = new ArrayList<>();
private Map<Integer, Double> retrialFullGroup = new HashMap<>() ;
private Retrial retrial;
......@@ -494,8 +494,16 @@ public class Queue extends InputSection {
//If the queue is infinite, the job is put into the queue and an ack is sent
job = message.getJob();
System.out.println("now dealing with" + job.getId());
System.out.println(retrialFullGroup);
if (retrialFullGroup.containsKey(job.getId())) {
// System.out.println(job.getId() + " " + "originally entered at: " + job.getSystemEnteringTime() +
// " re-entered at: " + retrialFullGroup.get(job.getId())
// + "retrialFullGroup size: " + retrialFullGroup.size());
}
System.out.println(job.getId() + " current queue size: " + nodeJobsList.size());
// System.out.println("jobs waiting to be retried: " + retrialFullGroup);
//----REDIRECTION BEHAVIOUR----------//
......@@ -541,6 +549,11 @@ public class Queue extends InputSection {
// job list but has been inserted in NetNode job list !!
if (infinite || nodeJobsList.size() <= size) {
// Queue is not full. Okay.
System.out.println(nodeJobsList.size());
if (retrialFullGroup.containsKey(job.getId())) {
System.out.println(job.getId() + " proceeds.");
}
// If parent node is a fork node adds job to FJ info list
if (getOwnerNode().getSection(NodeSection.OUTPUT) instanceof Fork) {
......@@ -556,6 +569,7 @@ public class Queue extends InputSection {
} else {
int jobsInService = getOwnerNode().getSection(NodeSection.SERVICE).getIntSectionProperty(NodeSection.PROPERTY_ID_RESIDENT_JOBS);
if (coolStart && (jobsInService < maxRunning || serviceCapacityInfinite)) {
// No jobs in queue: Refresh jobsList and sends job (do not use put strategy, because queue is empty)
if (jobsList.size() <= 0) {
jobsList.add(new JobInfo(job));
......@@ -563,14 +577,14 @@ public class Queue extends InputSection {
// forward without any delay
sendForward(jobsList.removeFirst().getJob(), 0.0);
} else { //queue is not empty(?)
} else { //queue is not empty (need to queue before service)
putStrategies[job.getJobClass().getId()].put(job, jobsList, this);
setRenegingEvent(job);
Job jobSent = getStrategy.get(jobsList);
sendForward(jobSent, 0.0);
}
forwardRenegingData(job, this.getNetSytem().getTime());
retrialFullGroup.remove(job.getId());
coolStart = false;
} else {
putStrategies[job.getJobClass().getId()].put(job, jobsList, this);
......@@ -580,10 +594,11 @@ public class Queue extends InputSection {
// sends an ACK backward
send(NetEvent.EVENT_ACK, job, 0.0, message.getSourceSection(), message.getSource());
} else {
// System.out.println("queue is full, " + job.getId() + " added to retrial");
// Queue is full. Now we use an additional queue or drop.
// if the job has been sent by the owner node of this queue section
if (isMyOwnerNode(message.getSource())) { // job sent by the node itself (corner case) -- should always be successful
if (isMyOwnerNode(message.getSource()) && !dropStrategies[0].equals(FINITE_RETRIAL)) { // job sent by the node itself (corner case) -- should always be successful
send(NetEvent.EVENT_ACK, job, 0.0, message.getSourceSection(), message.getSource()); // send acknowledgement to itself
addJobToBuffer(job, message, BufferType.WAITING_REQUESTS);
setRenegingEvent(job);
......@@ -601,13 +616,13 @@ public class Queue extends InputSection {
Exponential exponential = new Exponential();
RandomEngine randEngine = job.getNetSystem().getEngine();
exponential.setRandomEngine(randEngine);
randomDelay = exponential.nextRand(new ExponentialPar(0.5));
System.out.println("RandomDelay: " + randomDelay);
randomDelay = exponential.nextRand(new ExponentialPar(2));
// System.out.println("RandomDelay: " + randomDelay);
// retrial.generateImpatience(retrialDelay);
} catch (IncorrectDistributionParameterException e) {
e.printStackTrace();
}
retrialFullGroup.add(job.getId());
retrialFullGroup.put(job.getId(), job.getSystemEnteringTime() + randomDelay);
sendMe(NetEvent.EVENT_JOB, job, randomDelay);
} else {
......
  • Problem: Job supposed to be retry entering still added to nodeJobsList (primary queue)

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