|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.mygrid.scheduler.StorageAffinity
public class StorageAffinity
The StorageAffinity is a scheduling heuristic that uses the affinity between
a GridMachine
and a Task
to schedule. And the
affinity, that is in the GuM, is the amount that is calculated using the
sizes required by the task. For example: GuM1 (has file1 [200 KB], file2 [760
KB]) GuM2 (has file2 [760 KB]) GuM3 (has file1 [200 KB], file3 [600 KB])
Task1: (requires file2) Task2: (requires file1, file3) On the
schedule()
method call, the algorithm will search the biggest
affinity between the tasks and gums. The first assignment is GuM3 <-> Task2
with affinity 800. The second assignment is GuM1 <-> Task1 with affinity 760.
All the tasks are assigned and now, depending on replication degree, the last
gum will be assigned to the appropriated task. The third assignment is GuM2
<-> Task1 with affinity 760.
Field Summary | |
---|---|
protected GridManager |
gridManager
|
protected JobManager |
jobManager
|
Constructor Summary | |
---|---|
StorageAffinity(JobManager jobManager,
GridManager ebGridManager,
EBReplicaExecutorFacade ebReplicaExecutorFacade)
The constructor. |
Method Summary | |
---|---|
void |
addJob(int jobId,
JobSpec jobSpec)
Adds a new Job . |
void |
cancelJob(int jobId)
Cancels the given job and put an Event indicating that in the responseQueue. |
void |
executeReplica(ReplicaEntry replica,
GumClient gumClient)
It clones the replica and sends it to be executed by the ReplicaExecutor . |
long |
getAffinity(TaskEntry task,
GumClient gumex)
Calculates the affinity between a task and a gum. |
GridManager |
getEBGridManager()
Returns the EBGridManager . |
JobManager |
getEBJobManager()
Returns the EBJobManager . |
int |
getNumberOfNeededGums(JobSpec jobSpec)
Returns the number of needed Gums according the Job specification. |
protected int |
getReplicationDegreeOfTask(TaskEntry task)
Get the replication degree of a task |
protected java.lang.String |
getRequirementsOfJob(int jobId)
Returns a String representing the given job requirements. |
protected int |
getSmallestNumberOfReplicas(java.util.List<TaskEntry> tasksToScheduleQueue)
Get the smallest number of replicas for the list of Tasks to schedule |
protected java.util.List<TaskEntry> |
getTasksToScheduleQueue()
Gets the list of tasks to schedule. |
void |
newPeersHaveBeenSet()
Notifies the heuristic that new GridMachineProvider s have
been set. |
void |
replicaAborted(ReplicaExecutorResult result)
Notifies that a task replica has been aborted. |
void |
replicaCanceled(ReplicaExecutorResult result)
Notifies that a task replica has canceled. |
void |
replicaFailed(ReplicaExecutorResult result)
Notifies that a task replica has failed. |
void |
replicaFinished(ReplicaExecutorResult result)
Notifies that a task replica has finished. |
boolean |
schedule()
Tries to assign a task to a machine. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JobManager jobManager
protected GridManager gridManager
Constructor Detail |
---|
public StorageAffinity(JobManager jobManager, GridManager ebGridManager, EBReplicaExecutorFacade ebReplicaExecutorFacade)
jobManager
- The EBJobManager
ebGridManager
- The EBGridManager
ebReplicaExecutorFacade
- The EBReplicaExecutorFacade
Method Detail |
---|
public boolean schedule()
schedule
in interface EBSchedulingHeuristic
EBSchedulingHeuristic.schedule()
public long getAffinity(TaskEntry task, GumClient gumex) throws FailCauseException
task
- The task.gumex
- The grid machine extended.
FileTransferException
UnableToExecuteException
UnavailableGumException
UnavailableGumException
FileTransferException
UnableToExecuteException
FailCauseException
protected int getSmallestNumberOfReplicas(java.util.List<TaskEntry> tasksToScheduleQueue)
tasksToScheduleQueue
- - list of tasks to schedule
protected int getReplicationDegreeOfTask(TaskEntry task)
task
- The task
public final GridManager getEBGridManager()
EBSchedulingHeuristic
EBGridManager
.
getEBGridManager
in interface EBSchedulingHeuristic
EBGridManager
.EBSchedulingHeuristic.getEBGridManager()
public final JobManager getEBJobManager()
EBSchedulingHeuristic
EBJobManager
.
getEBJobManager
in interface EBSchedulingHeuristic
EBJobManager
.EBSchedulingHeuristic.getEBJobManager()
public void addJob(int jobId, JobSpec jobSpec)
EBSchedulingHeuristic
Job
.
addJob
in interface EBSchedulingHeuristic
jobId
- The job identification.jobSpec
- The new Job specification.EBSchedulingHeuristic.addJob(int,org.ourgrid.common.spec.JobSpec)
public void newPeersHaveBeenSet()
EBSchedulingHeuristic
GridMachineProvider
s have
been set. GridMachine
s should be requested to the
GridMachineProvider
s.
newPeersHaveBeenSet
in interface EBSchedulingHeuristic
EBSchedulingHeuristic.newPeersHaveBeenSet()
public int getNumberOfNeededGums(JobSpec jobSpec)
jobSpec
- The Job specification.
public void executeReplica(ReplicaEntry replica, GumClient gumClient)
ReplicaExecutor
. It also sets the replica state to
'Running' and sets the GridMachine
as allocated.
replica
- The replica to be executed.gumClient
- The GridMachine
to execute the replicapublic void replicaFinished(ReplicaExecutorResult result)
EBSchedulingHeuristic
replicaFinished
in interface EBSchedulingHeuristic
result
- The ReplicaExecutorResult
that contains all
information about the replica execution.EBSchedulingHeuristic.replicaFinished(ReplicaExecutorResult)
public void replicaAborted(ReplicaExecutorResult result)
EBSchedulingHeuristic
replicaAborted
in interface EBSchedulingHeuristic
result
- The ReplicaExecutorResult
that contains all
information about the replica execution.EBSchedulingHeuristic.replicaAborted(ReplicaExecutorResult)
public void replicaCanceled(ReplicaExecutorResult result)
EBSchedulingHeuristic
replicaCanceled
in interface EBSchedulingHeuristic
result
- The ReplicaExecutorResult
that contains all
information about the replica execution.EBSchedulingHeuristic.replicaCanceled(ReplicaExecutorResult)
public void replicaFailed(ReplicaExecutorResult result)
EBSchedulingHeuristic
replicaFailed
in interface EBSchedulingHeuristic
result
- The ReplicaExecutorResult
that contains all
information about the replica execution.By analyzing the cause of a task failure, it is possible to know
whether the failure has been provoked by an error in the application
or by a machine failure. In the first case, the grid machine has its
status set to READY, so it may be used again. In the latter case,
the gum entry is removed from the broker's Grid Manager.
public void cancelJob(int jobId) throws JobNotFoundException, JobCouldNotBeCancelledException
EBSchedulingHeuristic
cancelJob
in interface EBSchedulingHeuristic
jobId
- The job identification
JobNotFoundException
- if asked to cancel an invalid job.
JobCouldNotBeCancelledException
EBSchedulingHeuristic.cancelJob(int)
protected java.util.List<TaskEntry> getTasksToScheduleQueue()
protected java.lang.String getRequirementsOfJob(int jobId)
jobId
- The identification of the job to get the requirements
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |