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
raw 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.
raw 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.
raw 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.
raw 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.
raw 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.
raw 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) ]
raw docstring

get-portsclj

(get-ports rlist)

get-rangesclj

(get-ranges rlist name)

get-scalarclj

(get-scalar rlist name)

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
raw docstring

map-portsclj

(map-ports port-mappings ports)

naive-allocatorclj

(naive-allocator)

Conform to IAllocator by handing off decisions to allocate-naively

Conform to IAllocator by handing off decisions to allocate-naively
raw 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
raw docstring

resource-cmpclj

(resource-cmp r1 r2)

Comparator for resources. Will sort in decreasing order.

Comparator for resources. Will sort in decreasing order.
raw 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
raw docstring

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

× close