org.ourgrid.mygrid.scheduler
Class BlackListManager

java.lang.Object
  extended by org.ourgrid.mygrid.scheduler.BlackListManager

public class BlackListManager
extends java.lang.Object

This entity is responsible to maintain the Black List, the list of Gums that will not eb assigned to a Request after some failures. The Black List Manager will follow some rules as described bellow :

Dentro de um mesmo job, uma máquina poderá falhar n vezes, onde n = min(T, |J|) e T = definido pelo usuário.


Constructor Summary
BlackListManager()
          Cretes a new EBBlackListManager
BlackListManager(int maxFailsPerJobToEnterInBL)
          Cretes a new EBBlackListManager
 
Method Summary
 boolean canThisGumRunThisTask(int jobID, GumID gumID, int taskID)
          Returns true if no replicas of this task has been failed, false otherwise.
 int executionFailed(int jobID, GumID gumID, int taskID)
          Adds an entry to BlackList registry.
protected  java.util.Set<BlackListEntry> getBlackListedMachines(int jobID)
          Used in tests.
 int getMaxBLFails()
           
 int getRemainingBLFails(int jobID, GumID gumID)
          The number of remaining failed task executions to this Gum enter in the job black list.
 void initiateBlackListForJob(int jobId, int jobSize)
          Init data structures to manage the black list of this job.
 boolean isGumBlacklistedForEntireJob(int jobId, GumID gumID)
          Return true if the Gum has had failed min( jobSize, maxBLFails ) tasks of the job, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlackListManager

public BlackListManager()
Cretes a new EBBlackListManager


BlackListManager

public BlackListManager(int maxFailsPerJobToEnterInBL)
Cretes a new EBBlackListManager

Parameters:
maxFailsPerJobToEnterInBL - Default maximum number of failues befor the gum is blacklisted for a job.
Method Detail

executionFailed

public int executionFailed(int jobID,
                           GumID gumID,
                           int taskID)
Adds an entry to BlackList registry.

Parameters:
jobID - The request id thats this black list is associated to
gumID - The "Black Listed" GumID
Returns:
true if the GumID is successfully associated with this request id or false if the Gum was already associted.

getBlackListedMachines

protected java.util.Set<BlackListEntry> getBlackListedMachines(int jobID)
Used in tests.


getMaxBLFails

public int getMaxBLFails()

getRemainingBLFails

public int getRemainingBLFails(int jobID,
                               GumID gumID)
The number of remaining failed task executions to this Gum enter in the job black list.

Parameters:
jobID - The identification of the Job
gumID - The identification of the Gum
Returns:
The number of remaining failed task executions (of this job) to this Gum enter in the job black list.

canThisGumRunThisTask

public boolean canThisGumRunThisTask(int jobID,
                                     GumID gumID,
                                     int taskID)
Returns true if no replicas of this task has been failed, false otherwise.

Parameters:
jobID - The identification of the Job
gumID - The identification of the Gum
taskID - The identification of the Task
Returns:
True if no replicas of this task has been failed, false otherwise.

initiateBlackListForJob

public void initiateBlackListForJob(int jobId,
                                    int jobSize)
Init data structures to manage the black list of this job. A call in executionFailed method can result in a NullPointerException if the the data structures was not already initiated.

Parameters:
jobId - The identification of the job
jobSize - The number of Tasks of the job

isGumBlacklistedForEntireJob

public boolean isGumBlacklistedForEntireJob(int jobId,
                                            GumID gumID)
Return true if the Gum has had failed min( jobSize, maxBLFails ) tasks of the job, false otherwise.

Parameters:
jobId - The identification of the Job
gumID - The identification of the Gum
Returns:
True if the Gum has had failed min( jobSize, maxBLFails ) tasks of the job, false otherwise.