TaskInstance
An instance of a task to be performed in virtual time.
- Value Params
- created
The timestamp when this task was created.
- duration
The actual duration of the task.
- estimatedDuration
The estimated duration of the task.
- id
A unique id that separates this task from any other task. A workflow may spawn multiple tasks with the same name, so this is necessary.
- initialCost
A one-off cost of performing this task.
- interrupt
The number of times the task can be interrupted in favour of a more urgent one. This parameter is not currently being used.
- minStartTime
The earliest possible starting time of this task.
- name
A descriptive name.
- priority
The explicit priority of the task.
- resources
The names of the TaskResources required by this task.
- simulation
A unique name of the simulation this task belongs to.
- Note
We expect that task instances are only generated through a Task. The samples of the parameters are generated by the Coordinator. The duration can be specified through random sampling in a Distribution. We store the estimated value as well as the actual sampled value.
Value members
Concrete methods
Ordering of tasks.
Ordering of tasks.
This method essentially dictates the priority of tasks in the queue, highest to lowest.
Uses the following criteria, in order:
- '''Priority''': Putting this parameter first makes it a very strong influencer of priority. A task with higher explicit priority will always be executed before any other task with lower priority, even if, for example, the latter has been queueing for a long time.
- '''Age''': Tasks who were created earlier take priority, in an attempt to minimize waiting times.
- '''Resources''': Tasks that involve a higher number of resources take priority. The intuition is that it is generally harder to achieve a state where more resources are available at the same time, so we do not want to postpone the task.
- '''Estimated duration''': Tasks that require more time are prioritized.
- '''Interrupt''': Inflexible tasks that can not be interrupted are prioritized.
- Tasks are considered of equal priority at this point, so we use their id as a deterministic ordering.
- Value Params
- that
The task instance to compare to.
- Returns
A comparative measure (lower means higher priority).
- Note
You can change this order by subclassing TaskInstance and creating a corresponding subclass of Task.
Finds the soonest this task can start. This is based on the availability of the required resources. We calculate the minimum possible time when we expect all resources will be free. We use TaskResource.nextAvailableTimestamp as the (estimated) next available time of each resource.
Finds the soonest this task can start. This is based on the availability of the required resources. We calculate the minimum possible time when we expect all resources will be free. We use TaskResource.nextAvailableTimestamp as the (estimated) next available time of each resource.
- Value Params
- currentTime
The current timestamp.
- resourceMap
A map of all available TaskResources
- Returns
The (estimated) earliest timestamp when all resources are available.
The actual TaskResources required. Retrieves the actual objects (instead of just their names) from a map.
The actual TaskResources required. Retrieves the actual objects (instead of just their names) from a map.
- Value Params
- resourceMap
The map of available TaskResources
- Returns
The TaskResources required for this task.