douyinWEB/scripts/_diag_yt_long_jobs.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

43 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
import sys, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
def run(cmd):
_, o, e = c.exec_command(cmd, timeout=60)
return (o.read()+e.read()).decode("utf-8","replace").strip()
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
from app import db, yt_long_db
from app.yt_long_pipeline import yt_long_pipeline, try_enqueue_from_shorts, pick_yt_long_channel
db.init_db()
cfg = db.get_settings_map()
print('enabled', cfg.get('yt_long_enabled'))
print('with_shorts', cfg.get('yt_long_with_shorts'))
print('auto_upload', cfg.get('yt_long_auto_upload'))
print('daily_max', cfg.get('yt_long_daily_max'))
print('dedupe', cfg.get('yt_long_dedupe_room_day'))
chs = yt_long_db.list_yt_long_channels()
print('channels', len(chs))
for ch in chs[:5]:
print(' ch', ch.get('name'), 'en', ch.get('enabled'), 'rt', bool(str(ch.get('refresh_token') or '').strip()), 'dmax', ch.get('daily_max'))
st = yt_long_pipeline.status()
print('status', {k: st.get(k) for k in ['enabled','running','busy','quota_used','quota_gap','daily_max','last_error']})
print('stats', st.get('stats'))
jobs = yt_long_db.list_yt_long_jobs(limit=10)
print('jobs', len(jobs))
for j in jobs[:5]:
print(' j', j.get('status'), j.get('anchor_name'), j.get('error'))
picked = pick_yt_long_channel(cfg)
print('pick', picked.get('name') if picked else None)
# shorts pending/recording today?
from app.timeutil import push_date_from_ts
import time
day = push_date_from_ts(time.time())
sj = db.list_shorts_jobs(push_date=day, limit=5)
print('shorts_jobs_today_sample', len(sj.get('jobs') or []), 'total', sj.get('total'))
live = db.list_live_douyin_rooms_for_shorts(limit=5)
print('live_rooms', len(live))
PY"""))
c.close()