37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Restart Pro lanes on .4 and verify transcode profile."""
|
|
import sys
|
|
import time
|
|
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "10.88.0.4", "eric", "4669805"
|
|
LANES = [
|
|
"youtube2__ch_mpwri36r_z5lm2",
|
|
"youtube2__ch_mpyvqkc0_gj63k",
|
|
]
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=15)
|
|
|
|
|
|
def run(cmd: str, timeout: int = 90) -> str:
|
|
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
for lane in LANES:
|
|
print(f"\n=== start {lane} ===")
|
|
print(run(f"curl -sS -m 30 'http://127.0.0.1:8001/start?process={lane}'")[:500])
|
|
|
|
print("\n=== wait 15s ===")
|
|
time.sleep(15)
|
|
|
|
print(run("pgrep -af 'ffmpeg.*rtmps' | head -2"))
|
|
print(run("grep -hE 'stream copy|transcode|YouTube Live profile|hardware relay' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -8"))
|
|
print(run("grep -h 'speed=' /home/eric/d2ypp2-src/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -4"))
|
|
print(run("curl -sS -m 10 'http://127.0.0.1:8001/process_monitor?family=youtube' | python3 -m json.tool | head -60"))
|
|
|
|
c.close()
|