|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.mygrid.scheduler.jobmanager.TaskEntry
public class TaskEntry
An abstraction to represent a task of a job sent by user to be executed. A
task can be made of n replicas defined by maxReplicas
.
A replica is the lower level abstraction that is executed on the
GridMachine
s.
Field Summary | |
---|---|
protected java.util.List<ReplicaEntry> |
replicas
This Task 's Replica s. |
Constructor Summary | |
---|---|
TaskEntry(TaskSpec taskSpec,
int id,
int jobId,
int maxFails,
int maxReplicas)
The constructor. |
Method Summary | |
---|---|
boolean |
canReplicate()
Verifies if a task replica can be done. |
int |
compareTo(TaskEntry objectTask)
|
protected ReplicaEntry |
createReplicaEntry(int id,
int taskId,
int jobId,
TaskSpec taskSpec)
|
boolean |
equals(java.lang.Object o)
|
int |
getActualFails()
Returns the current number of replica fails. |
int |
getId()
Returns the Task identification. |
int |
getJobId()
Returns the job identification of this Task . |
int |
getMaxFails()
Returns the maximum number of replica fails a Task can
have. |
int |
getMaxReplicas()
Returns the maximum number of running replicas the Task
can have. |
ReplicaEntry |
getNewReplica()
Creates and returns a new Replica . |
int |
getNumberOfRunningReplicas()
Returns the number of running Replica s. |
int |
getNumberOfUnstartedReplicas()
Returns the number of unstarted Replica s. |
ReplicaEntry |
getReplicaById(int id)
Returns the Replica with the specified identification. |
java.util.Collection<ReplicaEntry> |
getReplicas()
Returns the Task 's Replica s. |
TaskSpec |
getSpec()
|
ExecutionStatus |
getState()
Returns the Task state. |
void |
replicaAborted(ReplicaExecutorResult result)
Sets a Replica state to Aborted, if the replica is
'Running'. |
void |
replicaCanceled(ReplicaExecutorResult result)
Sets a Replica state to Canceled by the User, if
the replica is 'Running' or 'Unstarted'. |
void |
replicaFailed(ReplicaExecutorResult result)
Sets a Replica state to Failed, if the replica is
'Running'. |
void |
replicaFinished(ReplicaExecutorResult result)
Sets a Replica state to Finished, if the replica
is 'Running'. |
void |
setCancelled()
Sets the task as canceled. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.List<ReplicaEntry> replicas
Task
's Replica
s.
Constructor Detail |
---|
public TaskEntry(TaskSpec taskSpec, int id, int jobId, int maxFails, int maxReplicas)
taskSpec
- The Task
specification.id
- This Task
identificationjobId
- The Job
identification.maxFails
- The maximum number of replicas' fails allowed.maxReplicas
- The maximum number of running Replica
s
permitted.Method Detail |
---|
public int getId()
Task
identification.
Task
identification.public int getJobId()
Task
.
Task
.public int getActualFails()
public int getMaxFails()
Task
can
have.
public int getMaxReplicas()
Task
can have.
public java.util.Collection<ReplicaEntry> getReplicas()
Task
's Replica
s.
Collection
containing all the
Replica
s.public ReplicaEntry getNewReplica()
Replica
.
Replica
in case that a replication is
possible to be made, null
otherwise.protected ReplicaEntry createReplicaEntry(int id, int taskId, int jobId, TaskSpec taskSpec)
public int getNumberOfRunningReplicas()
Replica
s.
Replica
s.public int getNumberOfUnstartedReplicas()
Replica
s.
Replica
s.public boolean canReplicate()
public void replicaFinished(ReplicaExecutorResult result)
Replica
state to Finished, if the replica
is 'Running'.
result
- The result of the replica executionpublic void replicaFailed(ReplicaExecutorResult result)
Replica
state to Failed, if the replica is
'Running'.
result
- The result of the replica executionpublic void replicaAborted(ReplicaExecutorResult result)
Replica
state to Aborted, if the replica is
'Running'.
result
- The result of the replica executionpublic void replicaCanceled(ReplicaExecutorResult result)
Replica
state to Canceled by the User, if
the replica is 'Running' or 'Unstarted'.
result
- The result of the replica executionpublic ExecutionStatus getState()
Task
state.
Task
state.
IllegalStateException
- - Case the Task
is not in
any of the expected states.public ReplicaEntry getReplicaById(int id)
Replica
with the specified identification.
id
- The Replica
identification.
Replica
case the identification exists,
null
otherwise.public int compareTo(TaskEntry objectTask)
compareTo
in interface java.lang.Comparable<TaskEntry>
Comparable.compareTo(java.lang.Object)
public java.lang.String toString()
toString
in class java.lang.Object
public void setCancelled()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public TaskSpec getSpec()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |