-
Notifications
You must be signed in to change notification settings - Fork 1
/
main-multi3.py
48 lines (37 loc) · 1.41 KB
/
main-multi3.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
47
48
from simulation import Simulation
from generators import *
from controllers import *
from runner import Runner
from applications import AppsCluster
from math import ceil
from monitoring import Monitoring, MultiMonitoring
import numpy as np
from commons import SN1, SN2, SP2, SP3, RP1, RP2, ALL
from itertools import combinations
import sys
name = sys.argv[0].split('.')[0]
stimes=[0.1, 0.4] # average service time of the MVA application (this is required by both the MVA application and the OPTCTRL)
appsCount = len(stimes)
appsSLA = [x*2 for x in stimes]
horizon = 50
monitoringWindow = 1
ctPeriod = 1
maxCores = 200000
Names=[f'App{i}' for i in range(1, appsCount+1)]
srateAvg=[1.0/stime for stime in stimes]
initCores=[10 for _ in stimes]
app=AppsCluster(appNames=Names,srateAvg=srateAvg,initCores=initCores,isDeterministic=False)
AppsCluster.sla=appsSLA
c1 = CTControllerScaleXNode(1, initCores, maxCores, BCs=[0,0], DCs=[1500, 1500])
c2 = OPTCTRL(monitoringWindow, init_cores=initCores, st=0.8, stime=[1/stimes[i] for i in range(appsCount)],maxCores=maxCores)
c2.setName("OPTCTRL")
c2.reset()
runner = Runner(horizon, [c1], monitoringWindow, app, lambda window, sla: MultiMonitoring([Monitoring(monitoringWindow, appsSLA[i]) for i in range(appsCount)]), name=name)
g = MultiGenerator([SN2, SN2])
#runner.run(g)
g = MultiGenerator([RP2, RP2])
#runner.run(g)
g = MultiGenerator([SP3, SP3])
runner.run(g)
runner.log()
runner.plot()