feat: Add time-restricted scheduling for worker2 (noise constraint)
- Worker2 (bd-host01) now only runs 19:00-06:00 due to noise - Added is_worker_allowed_to_run() function for time-based control - Worker1 continues 24/7 operation - Reset stuck chunk 14 that was blocking progress since Dec 2
This commit is contained in:
@@ -27,6 +27,9 @@ WORKERS = {
|
|||||||
'host': 'root@10.20.254.100',
|
'host': 'root@10.20.254.100',
|
||||||
'workspace': '/home/backtest_dual/backtest',
|
'workspace': '/home/backtest_dual/backtest',
|
||||||
'ssh_hop': 'root@10.10.254.106',
|
'ssh_hop': 'root@10.10.254.106',
|
||||||
|
'time_restricted': True, # Only run during off-hours due to noise
|
||||||
|
'allowed_start_hour': 19, # 7 PM
|
||||||
|
'allowed_end_hour': 6, # 6 AM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,6 +292,12 @@ def main():
|
|||||||
|
|
||||||
# Assign work to idle workers
|
# Assign work to idle workers
|
||||||
for worker_name in WORKERS.keys():
|
for worker_name in WORKERS.keys():
|
||||||
|
# Check if worker is allowed to run (time restrictions)
|
||||||
|
if not is_worker_allowed_to_run(worker_name):
|
||||||
|
if iteration % 10 == 0: # Log every 10 iterations to avoid spam
|
||||||
|
print(f"⏰ {worker_name} not allowed (office hours, noise restriction)")
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if worker is idle (simplified: assume one chunk per worker)
|
# Check if worker is idle (simplified: assume one chunk per worker)
|
||||||
conn = sqlite3.connect(DB_PATH)
|
conn = sqlite3.connect(DB_PATH)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|||||||
Reference in New Issue
Block a user