Skip to content

Commit 019851e

Browse files
bazilinskyyclaude
andcommitted
Pipeline status: one cookies warning per machine, naming each worker YouTube asks to sign in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c59b629 commit 019851e

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

‎dashboards/pipeline_status.py‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -245,24 +245,25 @@ def cookies_needed(workers, downloads):
245245
and any machine whose cookies file is signed out (check_signed)."""
246246
accounts = load_accounts()
247247

248-
def need(host, alias, why):
249-
a = accounts.get(alias) or {}
250-
f, d = a.get('file', 'cookies.txt'), a.get('dir', sw.REMOTE)
251-
link = f' && ln -sf {f} {d}/cookies.txt' if f != 'cookies.txt' else ''
252-
return dict(host=host, alias=alias, account=masked(a.get('email')), file=f, why=why,
253-
how=f"scp ~/Downloads/{f} {alias}:{d}/ && ssh {alias} 'chmod 600 {d}/{f}{link}'")
254-
out = []
248+
# machine: why it needs cookies; one warning a machine, its workers share its cookies (user, 2026-11-28)
249+
whys = {}
255250
for w in workers:
256251
if w.get('state') == 'blocked' and w['problems'] and SIGN_IN.search(w['problems'][-1]['text']):
257-
# a second worker on a machine shares its cookies
258-
out.append(need(w['host'], sw.place(w['host'])[0], 'YouTube asks its worker to sign in'))
252+
whys.setdefault(sw.place(w['host'])[0], []).append(f"YouTube asks {w['host']} to sign in")
259253
last = max((r['t'] for r in downloads.get('recent', [])), default=downloads.get('started', time.time()))
260254
if str(downloads.get('state', '')).startswith('paused') and time.time() - last > 2 * 3600:
261-
out.append(need(downloads['host'], downloads['host'], 'the downloader is paused')) # then its Chrome login
255+
whys.setdefault(downloads['host'], []).append('the downloader is paused') # then its Chrome login
262256
for alias, (t, got) in sorted(signed.items()):
263-
if got == 'out' and alias not in {c['alias'] for c in out}:
257+
if got == 'out':
264258
at = time.strftime('%H:%M', time.localtime(t))
265-
out.append(need(alias, alias, f'its cookies file is signed out (checked {at})'))
259+
whys.setdefault(alias, []).append(f'its cookies file is signed out (checked {at})')
260+
out = []
261+
for alias, why in whys.items():
262+
a = accounts.get(alias) or {}
263+
f, d = a.get('file', 'cookies.txt'), a.get('dir', sw.REMOTE)
264+
link = f' && ln -sf {f} {d}/cookies.txt' if f != 'cookies.txt' else ''
265+
out.append(dict(host=alias, alias=alias, account=masked(a.get('email')), file=f, why='; '.join(why),
266+
how=f"scp ~/Downloads/{f} {alias}:{d}/ && ssh {alias} 'chmod 600 {d}/{f}{link}'"))
266267
return out
267268

268269

@@ -881,8 +882,8 @@ def _check_cookies():
881882
assert [x['host'] for x in c] == ['lin5080'] and 'lin5080:crowd-routine/' in c[0]['how'], c
882883
assert masked('olena.bazilinska@gmail.com') == 'olena.b…@gmail.com'
883884
signed['lin5080'] = (time.time(), 'out') # also asked above: once
884-
c = cookies_needed([dict(w, host='lin5080b'), dict(w, host='mini', problems=[])], {})
885-
assert [x['alias'] for x in c] == ['lin5080'], c
885+
c = cookies_needed([dict(w, host='lin5080b'), dict(w, host='lin5080'), dict(w, host='mini', problems=[])], {})
886+
assert [x['host'] for x in c] == ['lin5080'] and c[0]['why'].count('asks') == 2 and 'signed out' in c[0]['why'], c
886887
signed['wsl5090'] = (time.time(), 'out')
887888
c = cookies_needed([], {})
888889
assert {x['host'] for x in c} == {'lin5080', 'wsl5090'} and 'signed out' in c[0]['why'], c

0 commit comments

Comments
 (0)