def main():
    allocator = Allocator()

    # Take
    allocator.add_agent('default', ResourceVector([9, 18]))

    allocator.add_framework(Scheduler('B', allocator, ResourceVector([1, 4])))
    allocator.add_framework(Scheduler('A', allocator, ResourceVector([3, 1])))

    # TODO: Replace with simulator run
    simulator = Simulator(allocator)
    simulator.tick(5)
def main():
    allocator = Allocator()

    # Take
    allocator.add_agent('default', ResourceVector([9, 18]))

    allocator.add_framework(InactiveScheduler('A', allocator))
    allocator.add_framework(InactiveScheduler('B', allocator))
    allocator.add_framework(InactiveScheduler('C', allocator))
    allocator.add_framework(InactiveScheduler('D', allocator))
    allocator.add_framework(InactiveScheduler('E', allocator))
    allocator.add_framework(
        StarvedScheduler('F', allocator, ResourceVector([1, 3])))

    # TODO: Replace with simulator run
    simulator = Simulator(allocator)
    simulator.tick(15)
    def __init__(self, resources):
        # Available resources
        self.total = resources

        # Consumed resource
        self.consumed = ResourceVector([0] * resources.dimensions())

        # User vector
        self.users = {}

        # Max fair share per user
        self.max_fair_share = {}
 def add_user(self, name):
     self.max_fair_share[name] = 0.0
     self.users[name] = ResourceVector([0] * self.total.dimensions())