Skip to content

Latest commit

 

History

History
82 lines (47 loc) · 2.49 KB

schedule_policies.md

File metadata and controls

82 lines (47 loc) · 2.49 KB

Scheduling Policies

Scheduling policies are the sort policies used by the transports to return tasks, the idea is to sort tasks when retrieving the full list in order to improve performances.

The main entrypoint for using policies is the execution_mode option sent to every transport.

Some transports can also use these policies to sort tasks when adding new ones.

Supported policies:

Extending the policies:

BatchPolicy

BatchPolicy (which can also be named as PriorityPolicy) aims to sort tasks using their priorities.

Each task is sorted in an ascendant way when returned.

Source

DeadlinePolicy

// TODO

Source

ExecutionDurationPolicy

Each task is sorted depending on the task execution duration and in an ascendant way.

Source

FirstInFirstOut

Each task is sorted depending on the scheduling date and in an ascendant way.

Source

FirstInLastOut

Each task is sorted depending on the scheduling date and in a descendant way.

Source

IdlePolicy

Each task is sorted depending on the priority and if this one is lower than 19 and in an ascendant way.

Source

MemoryUsage

Each task is tracked during its execution to keep information about the execution duration and so on, this policy use this information to sort tasks in an ascendant way, this policy can help when executing tasks in a "resources limited" environment.

Source

NicePolicy

Each task is sorted depending on the nice value and the priority and in an ascendant way.

Source

Creating custom policy

Creating a new policy is as easy as it sounds, first, you must implement the PolicyInterface.

Note: Each policy is automatically injected in the SchedulePolicyOrchestrator.