Liking cljdoc? Tell your friends :D

mesomatic.allocator

Resource Allocation

Resource Allocation
raw docstring

accept-offerclj

(accept-offer offer task pos)

Associate a task with an offer's corresponding slave. When allocating multiple instances of a task (for daemons) and the task-id field is a vector get the appropriate member of the vector

Associate a task with an offer's corresponding slave.
When allocating multiple instances of a task (for daemons) and
the task-id field is a vector get the appropriate member of the vector
sourceraw docstring

accept-portsclj

(accept-ports resources ports)

Eat up as many ports as specified in the first port range. Notice that only the first port range is considered for now.

Eat up as many ports as specified in the first port
range. Notice that only the first port range is considered
for now.
sourceraw docstring

adjust-offerclj

(adjust-offer offer task)

If an offer has been accepted, decrease its available resources.

If an offer has been accepted, decrease its available resources.
sourceraw docstring

adjust-portsclj

(adjust-ports ranges want)

Adjust port range. Notice that only the first range is considered.

Adjust port range. Notice that only the first range
is considered.
sourceraw docstring

adjustorclj

(adjustor cpus mem ports)

Yield a function which will adjust a resource record when appropriate.

Yield a function which will adjust a resource record
when appropriate.
sourceraw docstring

allocate-naivelyclj

(allocate-naively offers tasks)

Cycle through all tasks, sorted by biggest to smallest in terms of resource needs and try to satisfy requirements.

Cycle through all tasks, sorted by biggest to smallest
in terms of resource needs and try to satisfy requirements.
sourceraw docstring

allocate-task-naivelyclj

(allocate-task-naively acc {:keys [instances] :or {instances 1} :as task})

Allocate a task's worth of necessary resources. Tasks may ask for a specific count of instances and a maximum collocation factor to avoid behind hosted on a single slave.

Allocation technique

Let's assume the following workload and available offers:

[ T1(1,1,1,1) T2(4,8,2,1) T3(1,1,4,2) ] [ O1(4,8) O2(8,16) O3(2,2) ]

We first sort our offers:

[ T2(4,8,2,1) T3(1,1,4,2) T1(1,1,1,1) ] [ O1(8,16) O2(4,8) O3(2,2) ]

We can now step through tasks and allocate appropriately:

[ T3(1,1,4,2) T1(1,1,1,1) ] [ O1(4,8) O3(2,2) ] [ T1:(O1,O2) ]

[ T1(1,1,1,1) ] [ O1(2,6) ] [ T2:(O1,O2) T3(O1,O3) ]

[ ] [ O1(1,5) ] [ T2:(O1,O2) T3(O1,O3) T1(O1) ]

Allocate a task's worth of necessary resources.
Tasks may ask for a specific count of instances
and a maximum collocation factor to avoid behind
hosted on a single slave.

Allocation technique
====================

Let's assume the following workload and available offers:

  [ T1(1,1,1,1) T2(4,8,2,1) T3(1,1,4,2) ]
  [ O1(4,8) O2(8,16) O3(2,2) ]

We first sort our offers:

  [ T2(4,8,2,1) T3(1,1,4,2) T1(1,1,1,1) ]
  [ O1(8,16) O2(4,8) O3(2,2) ]

We can now step through tasks and allocate appropriately:

  [ T3(1,1,4,2) T1(1,1,1,1) ]
  [ O1(4,8) O3(2,2) ]
  [ T1:(O1,O2) ]

  [ T1(1,1,1,1) ]
  [ O1(2,6) ]
  [ T2:(O1,O2) T3(O1,O3) ]

  [ ]
  [ O1(1,5) ]
  [ T2:(O1,O2) T3(O1,O3) T1(O1) ]
sourceraw docstring

get-portsclj

(get-ports rlist)
source

get-rangesclj

(get-ranges rlist name)
source

get-scalarclj

(get-scalar rlist name)
source

IAllocatorcljprotocol

Allocator abstraction to allow for pluggable allocation techniques.

Allocator abstraction to allow for pluggable
allocation techniques.

allocateclj

(allocate this offers tasks)

Given a list of offers and tasks to start, figure out the best possible arrangement. Will yield a list of tasks containing an offerid to select or a nil if no way to fully fulfill requirements was found. Allocation should not yield partial results.

Resources taken into account are:

  • cpus
  • mem
  • port ranges

tasks is a list of mesomatic.types/TaskInfo offers is a list of mesomatic.types/Offer

Given a list of offers and tasks to start, figure out
the best possible arrangement. Will yield a list of tasks
containing an offerid to select or a nil if no way to fully
fulfill requirements was found. Allocation should not yield partial
results.

Resources taken into account are:

- cpus
- mem
- port ranges

tasks is a list of mesomatic.types/TaskInfo
offers is a list of mesomatic.types/Offer
sourceraw docstring

map-portsclj

(map-ports port-mappings ports)
source

naive-allocatorclj

(naive-allocator)

Conform to IAllocator by handing off decisions to allocate-naively

Conform to IAllocator by handing off decisions to allocate-naively
sourceraw docstring

offer-matches?clj

(offer-matches? offer task)

Predicate to validate an offer can satisfy a task's requirements

Predicate to validate an offer can satisfy a task's requirements
sourceraw docstring

resource-cmpclj

(resource-cmp r1 r2)

Comparator for resources. Will sort in decreasing order.

Comparator for resources. Will sort in decreasing order.
sourceraw docstring

resource-factorclj

(resource-factor {:keys [resources]})

Compute an integral resource factor to help sort offers

Compute an integral resource factor to help
sort offers
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close