|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.mygrid.scheduler.Workqueue
public class Workqueue
The Workqueue with Replication scheduler.
It picks tasks from the bag-of-tasks and assigns them to machines in
a random way. When the bag is empty and there are free machines, replicas of
running tasks are created and assigned to these machines. The idea is that
replicas assigned later can finish before the ones previously assigned,
improving the performance. When a replica finishes, the other replicas
related to the same task are aborted to free the machines.
Replicas are made until a pre-defined number. It can be definied in the
MG.properties file in a property called MG.maxreplicas. Replicas of
tasks are created based on a pre-defined policy.
Tasks with lower number of running replicas have priority to have their
replicas scheduled. If the number of running replicas is the same, the task
with the lower job id has priority. If also the job ids are equals, the task
with the lower task id has priority.
Field Summary | |
---|---|
protected GridManager |
gridManager
|
protected JobManager |
jobManager
|
Constructor Summary | |
---|---|
Workqueue(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 . |
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 java.lang.String |
getRequirementsOfJob(int jobId)
Returns a String representing the given job requirements. |
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 Workqueue(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 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 |