-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrun.py
33 lines (27 loc) · 897 Bytes
/
run.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
from UPISAS.strategies.swim_reactive_strategy import ReactiveAdaptationManager
from UPISAS.exemplar import Exemplar
from UPISAS.exemplars.swim import SWIM
import signal
import sys
import time
if __name__ == '__main__':
exemplar = SWIM(auto_start=True)
time.sleep(3)
exemplar.start_run()
time.sleep(3)
try:
strategy = ReactiveAdaptationManager(exemplar)
strategy.get_monitor_schema()
strategy.get_adaptation_options_schema()
strategy.get_execute_schema()
while True:
input("Try to adapt?")
strategy.monitor(verbose=True)
if strategy.analyze():
if strategy.plan():
strategy.execute()
except (Exception, KeyboardInterrupt) as e:
print(str(e))
input("something went wrong")
exemplar.stop_container()
sys.exit(0)