update Walk.py and update models for Walk gym

This commit is contained in:
xxh
2026-04-15 04:47:56 -04:00
parent 43067000db
commit 29adc4b3df
4 changed files with 1159 additions and 51 deletions

View File

@@ -7,7 +7,7 @@ import threading
class Server():
WATCHDOG_ENABLED = True
WATCHDOG_INTERVAL_SEC = 30.0
WATCHDOG_RSS_MB_LIMIT = 1000.0
WATCHDOG_RSS_MB_LIMIT = 800
def __init__(self, first_server_p, first_monitor_p, n_servers, no_render=True, no_realtime=True) -> None:
try:
@@ -109,14 +109,29 @@ class Server():
def check_running_servers(self, psutil, first_server_p, first_monitor_p, n_servers):
''' Check if any server is running on chosen ports '''
found = False
p_list = [p for p in psutil.process_iter() if p.cmdline() and "rcssservermj" in " ".join(p.cmdline())]
range1 = (first_server_p, first_server_p + n_servers)
range2 = (first_monitor_p, first_monitor_p + n_servers)
bad_processes = []
def safe_cmdline(proc):
try:
return proc.cmdline()
except (psutil.ZombieProcess, psutil.NoSuchProcess, psutil.AccessDenied, OSError):
return []
p_list = []
for p in psutil.process_iter():
cmdline = safe_cmdline(p)
if cmdline and "rcssservermj" in " ".join(cmdline):
p_list.append(p)
for p in p_list:
# currently ignoring remaining default port when only one of the ports is specified (uncommon scenario)
ports = [int(arg) for arg in p.cmdline()[1:] if arg.isdigit()]
cmdline = safe_cmdline(p)
if not cmdline:
continue
ports = [int(arg) for arg in cmdline[1:] if arg.isdigit()]
if len(ports) == 0:
ports = [60000, 60100] # default server ports (changing this is unlikely)
@@ -128,7 +143,7 @@ class Server():
print("\nThere are already servers running on the same port(s)!")
found = True
bad_processes.append(p)
print(f"Port(s) {','.join(conflicts)} already in use by \"{' '.join(p.cmdline())}\" (PID:{p.pid})")
print(f"Port(s) {','.join(conflicts)} already in use by \"{' '.join(cmdline)}\" (PID:{p.pid})")
if found:
print()