-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
21 lines (19 loc) · 716 Bytes
/
cli.py
File metadata and controls
21 lines (19 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from logzero import logger
from src.constant import CONSTANT
from src.simulation import Simulation
from src.utils import logging
if __name__ == "__main__":
logging.setup_logger()
simulation = Simulation()
while True:
simulation.update()
system_time = simulation.get_current_time()
if simulation.has_completed_all_jobs():
logger.info(f"Time: {system_time:,.0f}. All jobs are completed. Stop.")
break
if simulation.has_deadlock():
logger.info(
f"Time: {system_time:,.0f}. Dead-lock detected. No HT moves in the past {CONSTANT.DEADLOCK_THRESHOLD} secs."
)
break
simulation.export_job_report()