GreedyScheduler

A greedy Scheduler.

Starts all tasks whose resources are currently idle, in the given order/priority.

This means a lower priority task may start now and block a higher priority task which is currently blocked, but could have started soon.

trait Scheduler
class Object
trait Matchable
class Any

Value members

Concrete methods

@tailrec
final protected
def findNextTasks(idleResources: Map[String, TaskResource], tasks: Iterable[TaskInstance], result: Queue[TaskInstance]): Seq[TaskInstance]

Finds the Tasks that can be started now.

Finds the Tasks that can be started now.

Goes through the priority list of tasks and returns those whose resources are idle (even after starting higher priority tasks).

Value Params
idleResources

The map of idle TaskResources.

result

The accumulated TaskInstances so far (for tail recursion).

tasks

The set of TaskInstances that need to start.

Returns

The sequence of TaskInstances to start now.

override
def getNextTasks(currentTime: Long, resourceMap: Map[String, TaskResource]): Seq[TaskInstance]
Definition Classes

Inherited methods

def addTask(task: TaskInstance): Unit

Adds a TaskInstance to be scheduled.

Adds a TaskInstance to be scheduled.

Value Params
task

The TaskInstance to add.

Inherited from
Scheduler
def complete(task: TaskInstance, time: Long): Unit

Adds an Task described by an (ID,time) pair to the list of completed IDs

Adds an Task described by an (ID,time) pair to the list of completed IDs

Value Params
id

The ID to be added

time

The time at which the task completed

Returns

A LookaheadStructure with this (ID,time) pair added to the list of completed tasks

Inherited from
Scheduler
def getTasks(): Iterable[TaskInstance]

Retrieves an iterable collection of queued TaskInstances.

Retrieves an iterable collection of queued TaskInstances.

Returns

The TaskInstances in the scheduling queue.

Inherited from
Scheduler
def isIdleResource(r: String, resourceMap: Map[String, TaskResource]): Boolean

Checks if a named TaskResource is idle.

Checks if a named TaskResource is idle.

Value Params
r

The name of the TaskResource.

resourceMap

The map of available TaskResources.

Returns

true if the resource is idle, false otherwise.

Inherited from
Scheduler
def noMoreTasks(): Boolean

Checks if all Tasks have been scheduled.

Checks if all Tasks have been scheduled.

Returns

true if there are no Tasks remaining.

Inherited from
Scheduler
def removeLookahead(simulation: String): Unit

Removes the lookahead structure associated with the given actor.

Removes the lookahead structure associated with the given actor.

Value Params
actor

The actor corresponding to the lookahead structure.

Inherited from
Scheduler
def removeSimulation(simulation: String): Unit

Removes all TaskInstances belonging to an (presumably aborted) simulation.

Removes all TaskInstances belonging to an (presumably aborted) simulation.

Value Params
simulation

The name of the simulation that was aborted.

Inherited from
Scheduler
def removeTask(task: TaskInstance): Unit

Removes a TaskInstance that no longer needs scheduling.

Removes a TaskInstance that no longer needs scheduling.

Value Params
task

The TaskInstance to remove.

Inherited from
Scheduler
def setLookahead(simulation: String, obj: Lookahead): Unit

Sets the lookahead structure for the specified actor.

Sets the lookahead structure for the specified actor.

Value Params
actor

The actor that created this lookahead structure.

obj

The lookahead structure.

Inherited from
Scheduler