-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patharbiter.py
46 lines (36 loc) · 1.04 KB
/
arbiter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import logging
from abc import ABC
from simulator import clock, schedule_event, cancel_event, reschedule_event
class Arbiter(ABC):
"""
Arbiter allocates Processors to Application Allocators.
It can be used to support application autoscaling.
"""
def __init__(self,
cluster,
overheads):
self.cluster = cluster
self.overheads = overheads
self.servers = cluster.servers
self.applications = []
self.allocators = {}
def add_application(self, application):
self.applications.append(application)
self.allocators[application.application_id] = application.allocator
def run(self):
pass
def allocate(self, processors, application):
"""
Allocates processors to the application.
"""
pass
def deallocate(self, processors, application):
"""
Deallocates processors from the application.
"""
pass
class NoOpArbiter(Arbiter):
"""
No-op Arbiter.
"""
pass