in scheduler.py [0:0]
def iterate_logs(opt_path, num_of_week, yugong):
with open(f"{opt_path}/fix.csv", "w") as f:
f.write("period,cloud_computation_target,P90_traffic_bps,P95_traffic_bps,P99_traffic_bps,"
"movement_ingress_bytes,movement_egress_bytes,rep_bytes,sample_rate\n")
for c in [30, 50, 70]:
period_day = 7
period_start = datetime.strptime("2024-10-29", "%Y-%m-%d")
for period_offset in range(num_of_week):
start_date = period_start + timedelta(days=period_offset * period_day)
p90, p95, p99 = calculate_traffic_percentiles(os.path.join(opt_path, f"c{c}"), start_date, start_date + timedelta(days=period_day-1), debug=True)
if period_offset == 0:
label = ""
else:
label = "_" + (start_date - timedelta(days=period_day)).strftime("%m%d")
if yugong:
opt_dir_path = os.path.join(opt_path, f"test_run_c{c}_bw0.20_local{100-c}{label}")
else:
opt_dir_path = os.path.join(opt_path, f"test_run_c{c}_bw0.02_local{100-c}{label}")
log_file = os.path.join(opt_dir_path, "log.txt")
if os.path.exists(log_file):
movement_ingress, movement_egress, rep_size, sample_rate = extract_movement_rep_and_sample(log_file)
f.write(f"{start_date.strftime('%Y%m%d')}-{(start_date + timedelta(days=period_day-1)).strftime('%Y%m%d')},"
f"{c},{p90},{p95},{p99},{movement_ingress},{movement_egress},{rep_size},{sample_rate}\n")