faraway00 commited on
Commit
4e17899
·
verified ·
1 Parent(s): 6947a26

Refresh verified six-GPU manifest: 26 tuples

Browse files
metadata.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
pipeline/sixgpu_publish.py CHANGED
@@ -3,7 +3,7 @@ import json, os, sqlite3, time
3
  from pathlib import Path
4
  from huggingface_hub import HfApi, CommitOperationAdd
5
 
6
- ROOT=Path('/opt/styleedit-sixgpu-20261024')
7
  APP=Path('/opt/styleedit-streaming-20261024')
8
  def publish():
9
  manifest=[]
@@ -27,7 +27,7 @@ def publish():
27
  ops=[CommitOperationAdd(path_in_repo='metadata.jsonl',path_or_fileobj=str(out))]
28
  status=ROOT/'status.json'
29
  if status.exists():ops.append(CommitOperationAdd(path_in_repo='progress/sixgpu-status.json',path_or_fileobj=str(status)))
30
- for name in ['sixgpu_run.py','sixgpu_publish.py','workers.py','SIXGPU.md','pipeline.py','streaming.py','live_index.py','verify_live.py','archive_cache.py','download_archives.py']:
31
  ops.append(CommitOperationAdd(path_in_repo='pipeline/'+name,path_or_fileobj=str(APP/name)))
32
  c=HfApi().create_commit(repo_id='faraway00/StyleEdit',repo_type='dataset',operations=ops,
33
  commit_message=f'Refresh verified six-GPU manifest: {len(manifest)} tuples')
 
3
  from pathlib import Path
4
  from huggingface_hub import HfApi, CommitOperationAdd
5
 
6
+ ROOT=Path('/opt/styleedit-sixgpu-recovered')
7
  APP=Path('/opt/styleedit-streaming-20261024')
8
  def publish():
9
  manifest=[]
 
27
  ops=[CommitOperationAdd(path_in_repo='metadata.jsonl',path_or_fileobj=str(out))]
28
  status=ROOT/'status.json'
29
  if status.exists():ops.append(CommitOperationAdd(path_in_repo='progress/sixgpu-status.json',path_or_fileobj=str(status)))
30
+ for name in ['sixgpu_run.py','sixgpu_publish.py','workers.py']:
31
  ops.append(CommitOperationAdd(path_in_repo='pipeline/'+name,path_or_fileobj=str(APP/name)))
32
  c=HfApi().create_commit(repo_id='faraway00/StyleEdit',repo_type='dataset',operations=ops,
33
  commit_message=f'Refresh verified six-GPU manifest: {len(manifest)} tuples')
pipeline/sixgpu_run.py CHANGED
@@ -4,8 +4,8 @@ from pathlib import Path
4
 
5
  APP = Path(__file__).resolve().parent
6
  PERSIST = Path('/workspace/styleedit-streaming-20261024')
7
- ROOT = Path('/opt/styleedit-sixgpu-20261024')
8
- STATE = ROOT
9
  PY = '/opt/da3-depth-env/bin/python'
10
 
11
  def save(path, value):
@@ -26,27 +26,16 @@ def prepare():
26
  styles = sorted({r['style_id'] for r in rows})
27
  # Entire styles belong to one GPU, so the 100-source quota needs no cross-process race.
28
  assignment = {s:i%6 for i,s in enumerate(styles)}
29
- shutil.copyfile(PERSIST/'state/jobs.sqlite', '/opt/styleedit-prior.sqlite')
30
- prior = sqlite3.connect('/opt/styleedit-prior.sqlite')
31
- old = prior.execute('SELECT id,style_id,source,status,record,verified_at,cleaned FROM jobs').fetchall()
32
- prior.close()
33
  pilot = json.loads((APP/'pilot-plan.json').read_text())
34
  for gpu in range(6):
35
- state = STATE/f'gpu{gpu}'; state.mkdir(parents=True,exist_ok=True)
36
- persisted=ROOT/f'gpu{gpu}'/'jobs.sqlite'
37
- if not (state/'jobs.sqlite').exists() and persisted.exists():
38
- shutil.copyfile(persisted,state/'jobs.sqlite')
39
  db = sqlite3.connect(state/'jobs.sqlite')
40
  db.execute('CREATE TABLE IF NOT EXISTS jobs(id TEXT PRIMARY KEY,style_id TEXT,source TEXT,status TEXT,record TEXT,verified_at REAL,cleaned INTEGER DEFAULT 0)')
41
  for row in old:
42
  if assignment.get(row[1]) == gpu and row[3] in ('verified','reject'):
43
  db.execute('INSERT OR IGNORE INTO jobs VALUES(?,?,?,?,?,?,?)', row)
44
- # A receipt is persisted synchronously before verified is committed locally.
45
- # Recover an upload that finished between the last database snapshot and Pod loss.
46
- for path in (ROOT/f'gpu{gpu}'/'receipts').glob('*.json'):
47
- receipt=json.loads(path.read_text()); r=receipt['record']
48
- db.execute('INSERT OR IGNORE INTO jobs VALUES(?,?,?,?,?,?,?)',
49
- (r['id'],r['style_id'],r['source_path'],'verified',json.dumps(receipt),path.stat().st_mtime,1))
50
  db.commit(); db.close()
51
  save(APP/f'plan-gpu{gpu}.json', [r for r in rows if assignment[r['style_id']]==gpu])
52
  save(APP/f'pilot-gpu{gpu}.json', [r for r in pilot if assignment[r['style_id']]==gpu])
@@ -54,16 +43,16 @@ def prepare():
54
 
55
  def processing(gpu, pilot=False):
56
  return spawn([APP/'pipeline.py', '--plan', APP/f'{"pilot" if pilot else "plan"}-gpu{gpu}.json',
57
- '--state', STATE/f'gpu{gpu}', '--scratch', f'/opt/styleedit-sixgpu-scratch/gpu{gpu}',
58
- '--index-state', ROOT/'indexes', '--limit','0','--per-style','100',
59
  '--window','6','--download-workers','4','--upload-workers','1',
60
  '--scratch-gib','60','--reserve-gib','40','--cleanup-seconds','60',
61
- *(['--seed-ranges'] if pilot else ['--incremental-index'])], ROOT/f'gpu{gpu}-{ "pilot" if pilot else "production"}.log', gpu)
62
 
63
  def aggregate(stage, children):
64
  counts = collections.Counter(); statuses = collections.Counter(); dirty = 0
65
  for gpu in range(6):
66
- db = sqlite3.connect(STATE/f'gpu{gpu}'/'jobs.sqlite', timeout=30)
67
  counts.update(dict(db.execute("SELECT style_id,count(*) FROM jobs WHERE status='verified' GROUP BY style_id")))
68
  statuses.update(dict(db.execute('SELECT status,count(*) FROM jobs GROUP BY status')))
69
  dirty += db.execute("SELECT count(*) FROM jobs WHERE status='verified' AND cleaned=0").fetchone()[0]
@@ -71,6 +60,10 @@ def aggregate(stage, children):
71
  save(ROOT/'status.json', {'utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'stage':stage,
72
  'verified':sum(counts.values()),'counts':dict(counts),'statuses':dict(statuses),
73
  'verified_pending_cleanup':dirty,'processes':{k:{'pid':v.pid,'returncode':v.poll()} for k,v in children.items()}})
 
 
 
 
74
 
75
  def index_merge():
76
  target = Path('/opt/styleedit-exact-index'); target.mkdir(exist_ok=True)
@@ -94,35 +87,36 @@ def main():
94
  lock=open(ROOT/'supervisor.lock','a'); fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
95
  prepare()
96
  from huggingface_hub import HfApi
97
- api=HfApi(); print('HF_AUTH',api.whoami()['name'],flush=True)
98
- api.auth_check('faraway00/StyleEdit', repo_type='dataset')
99
  children={}
100
- known=json.loads((ROOT/'index-pids.json').read_text()) if (ROOT/'index-pids.json').exists() else {}
101
  for category in ['source','global_style1','global_style2']:
102
  path=ROOT/'indexes'/category
103
- pid=known.get(category)
104
- proc=Path(f'/proc/{pid}/cmdline')
105
- if pid and proc.exists() and str(path).encode() in proc.read_bytes():
106
- children['index-'+category]=ExistingIndex(pid,path,category)
107
- else:
108
- children['index-'+category]=spawn([APP/'pipeline.py','--index',category,'--index-state',path], ROOT/f'index-{category}.log')
109
- save(ROOT/'index-pids.json',{cat:children['index-'+cat].pid for cat in ['source','global_style1','global_style2']})
110
- for gpu in range(6):children[f'gpu-{gpu}']=processing(gpu)
111
  while any(p.poll() is None for p in children.values()):
112
- aggregate('indexing_and_production',children)
113
  # Failed index is fatal; preserve all checkpoints and media.
114
  failed=[k for k,p in children.items() if k.startswith('index-') and p.poll() not in (None,0)]
115
  if failed: raise RuntimeError('Index failed; inspect logs: '+str(failed))
116
  time.sleep(30)
117
- aggregate('complete' if all(p.poll()==0 for p in children.values()) else 'needs_attention',children)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  print('SIX_GPU_FINISHED',flush=True)
119
 
120
- class ExistingIndex:
121
- def __init__(self,pid,path,category):self.pid=pid;self.path=path;self.category=category
122
- def poll(self):
123
- stat=Path(f'/proc/{self.pid}/stat')
124
- if stat.exists() and stat.read_text().split()[2]!='Z':return None
125
- checkpoint=self.path/(self.category+'.checkpoint.json')
126
- return 0 if checkpoint.exists() and json.loads(checkpoint.read_text()).get('complete') else 1
127
-
128
  if __name__=='__main__': main()
 
4
 
5
  APP = Path(__file__).resolve().parent
6
  PERSIST = Path('/workspace/styleedit-streaming-20261024')
7
+ from recovery_state import LOCAL_ROOT, DURABLE_ROOT, copy_atomic
8
+ ROOT = LOCAL_ROOT
9
  PY = '/opt/da3-depth-env/bin/python'
10
 
11
  def save(path, value):
 
26
  styles = sorted({r['style_id'] for r in rows})
27
  # Entire styles belong to one GPU, so the 100-source quota needs no cross-process race.
28
  assignment = {s:i%6 for i,s in enumerate(styles)}
29
+ # Recovery copied all six existing shards, including their WAL, to local disk.
30
+ old = []
 
 
31
  pilot = json.loads((APP/'pilot-plan.json').read_text())
32
  for gpu in range(6):
33
+ state = ROOT/f'gpu{gpu}'; state.mkdir(exist_ok=True)
 
 
 
34
  db = sqlite3.connect(state/'jobs.sqlite')
35
  db.execute('CREATE TABLE IF NOT EXISTS jobs(id TEXT PRIMARY KEY,style_id TEXT,source TEXT,status TEXT,record TEXT,verified_at REAL,cleaned INTEGER DEFAULT 0)')
36
  for row in old:
37
  if assignment.get(row[1]) == gpu and row[3] in ('verified','reject'):
38
  db.execute('INSERT OR IGNORE INTO jobs VALUES(?,?,?,?,?,?,?)', row)
 
 
 
 
 
 
39
  db.commit(); db.close()
40
  save(APP/f'plan-gpu{gpu}.json', [r for r in rows if assignment[r['style_id']]==gpu])
41
  save(APP/f'pilot-gpu{gpu}.json', [r for r in pilot if assignment[r['style_id']]==gpu])
 
43
 
44
  def processing(gpu, pilot=False):
45
  return spawn([APP/'pipeline.py', '--plan', APP/f'{"pilot" if pilot else "plan"}-gpu{gpu}.json',
46
+ '--state', ROOT/f'gpu{gpu}', '--scratch', f'/opt/styleedit-sixgpu-scratch/gpu{gpu}',
47
+ '--index-state', '/opt/styleedit-exact-index', '--limit','0','--per-style','100',
48
  '--window','6','--download-workers','4','--upload-workers','1',
49
  '--scratch-gib','60','--reserve-gib','40','--cleanup-seconds','60',
50
+ *(['--seed-ranges'] if pilot else [])], ROOT/f'gpu{gpu}-{ "pilot" if pilot else "production"}.log', gpu)
51
 
52
  def aggregate(stage, children):
53
  counts = collections.Counter(); statuses = collections.Counter(); dirty = 0
54
  for gpu in range(6):
55
+ db = sqlite3.connect(ROOT/f'gpu{gpu}'/'jobs.sqlite', timeout=30)
56
  counts.update(dict(db.execute("SELECT style_id,count(*) FROM jobs WHERE status='verified' GROUP BY style_id")))
57
  statuses.update(dict(db.execute('SELECT status,count(*) FROM jobs GROUP BY status')))
58
  dirty += db.execute("SELECT count(*) FROM jobs WHERE status='verified' AND cleaned=0").fetchone()[0]
 
60
  save(ROOT/'status.json', {'utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'stage':stage,
61
  'verified':sum(counts.values()),'counts':dict(counts),'statuses':dict(statuses),
62
  'verified_pending_cleanup':dirty,'processes':{k:{'pid':v.pid,'returncode':v.poll()} for k,v in children.items()}})
63
+ try:
64
+ copy_atomic(ROOT/'status.json', DURABLE_ROOT/'status.json')
65
+ except OSError as exc:
66
+ print('STATUS_SNAPSHOT_RETRY',type(exc).__name__,str(exc),flush=True)
67
 
68
  def index_merge():
69
  target = Path('/opt/styleedit-exact-index'); target.mkdir(exist_ok=True)
 
87
  lock=open(ROOT/'supervisor.lock','a'); fcntl.flock(lock,fcntl.LOCK_EX|fcntl.LOCK_NB)
88
  prepare()
89
  from huggingface_hub import HfApi
 
 
90
  children={}
 
91
  for category in ['source','global_style1','global_style2']:
92
  path=ROOT/'indexes'/category
93
+ children['index-'+category]=spawn([APP/'pipeline.py','--index',category,'--index-state',path], ROOT/f'index-{category}.log')
94
+ # All six pilot workers already completed; resume exact indexing directly.
 
 
 
 
 
 
95
  while any(p.poll() is None for p in children.values()):
96
+ aggregate('indexing',children)
97
  # Failed index is fatal; preserve all checkpoints and media.
98
  failed=[k for k,p in children.items() if k.startswith('index-') and p.poll() not in (None,0)]
99
  if failed: raise RuntimeError('Index failed; inspect logs: '+str(failed))
100
  time.sleep(30)
101
+ aggregate('pilot_complete',children)
102
+ # Pilot's quota deficit gives exit 2 by design. Upload/model errors are not safe to ignore.
103
+ for gpu in range(6):
104
+ summary=json.loads((ROOT/f'gpu{gpu}'/'summary.json').read_text())
105
+ if summary['errors']:raise RuntimeError(f'Pilot GPU {gpu} errors: inspect summary before production')
106
+ index_merge()
107
+ # Public archive indexing can progress while the original login is restored.
108
+ while True:
109
+ try:
110
+ api=HfApi(); api.whoami(); api.auth_check('faraway00/StyleEdit', repo_type='dataset')
111
+ break
112
+ except Exception as exc:
113
+ aggregate('awaiting_hf_auth',{})
114
+ print('WAITING_FOR_HF_AUTH',type(exc).__name__,flush=True)
115
+ time.sleep(60)
116
+ children={f'gpu-{g}':processing(g) for g in range(6)}
117
+ while any(p.poll() is None for p in children.values()):
118
+ aggregate('production',children); time.sleep(30)
119
+ aggregate('complete' if all(p.returncode==0 for p in children.values()) else 'needs_attention',children)
120
  print('SIX_GPU_FINISHED',flush=True)
121
 
 
 
 
 
 
 
 
 
122
  if __name__=='__main__': main()
progress/sixgpu-status.json CHANGED
@@ -1,112 +1,41 @@
1
  {
2
- "utc": "2026-10-24T06:18:53Z",
3
- "stage": "needs_attention",
4
- "verified": 142,
5
  "counts": {
6
- "00e5f0752aae": 1,
7
- "10ae00528692": 1,
8
- "26b03a8ae47d": 2,
9
- "4744afcbd909": 4,
10
- "5501b7377488": 4,
11
- "6ea8adbc0823": 3,
12
- "817d0d364240": 1,
13
- "baf401925b12": 3,
14
- "d2bef4453db8": 2,
15
- "ef610916460f": 2,
16
- "0423a6080620": 2,
17
- "2cb8a9c29e3c": 3,
18
- "3ac416bb5d5d": 3,
19
- "4d36d1bce511": 1,
20
- "6f448a5d5b0b": 1,
21
- "81b0039d0562": 2,
22
- "9b955dbb5c1b": 4,
23
- "aceae18cfd54": 4,
24
- "c3c090430cbb": 2,
25
- "f67cd2014f0f": 2,
26
- "09229cb3538e": 3,
27
- "3ec4685a5ca4": 1,
28
- "593b6d061243": 4,
29
- "9fd740550a13": 2,
30
- "b4b7ccdb3223": 1,
31
- "c44e535bbe8e": 2,
32
- "da3f08c0ab94": 1,
33
- "e4157f8b450b": 6,
34
- "f67ebc7f1288": 2,
35
  "0972e1eed1b3": 1,
36
- "182ecc60160c": 3,
37
- "305681c6a53f": 2,
38
- "43ab900339a0": 1,
39
- "522b61489406": 1,
40
- "a55078c730d6": 1,
41
- "b4c4c14310ba": 1,
42
  "cace0fd21b19": 1,
43
  "ec2035ada05d": 1,
44
- "f990050311bc": 13,
45
- "0bee0e7e6dc5": 2,
46
  "18af27ddab58": 1,
47
- "33286a1a191b": 1,
48
  "52545659e5cb": 1,
49
  "5dff93f3a267": 1,
50
- "7ac8d62ccfb2": 1,
51
- "85246a0d9ced": 3,
52
- "a56ad3f24408": 1,
53
- "b5c8be681334": 1,
54
- "ce16eed69d0e": 12,
55
  "0fee9b184beb": 1,
56
- "194290896821": 4,
57
- "36f7a34ae77c": 1,
58
- "453daa7e1ef3": 2,
59
  "526f7f26e7a6": 1,
60
- "810c3bcf0812": 1,
61
- "8f84dd32762c": 4,
62
- "a78ae8b77085": 2,
63
- "b7eb902e7b22": 1,
64
- "cfdb284d6b07": 3,
65
- "ee3d28fd4cc8": 3,
66
- "ff3dbf0e95b5": 1
67
  },
68
  "statuses": {
69
- "reject": 23,
70
- "uploading": 39,
71
- "verified": 142
72
  },
73
- "verified_pending_cleanup": 0,
74
- "processes": {
75
- "index-source": {
76
- "pid": 18737,
77
- "returncode": 0
78
- },
79
- "index-global_style1": {
80
- "pid": 18738,
81
- "returncode": 0
82
- },
83
- "index-global_style2": {
84
- "pid": 18739,
85
- "returncode": 0
86
- },
87
- "gpu-0": {
88
- "pid": 18740,
89
- "returncode": 1
90
- },
91
- "gpu-1": {
92
- "pid": 18741,
93
- "returncode": 1
94
- },
95
- "gpu-2": {
96
- "pid": 18742,
97
- "returncode": 1
98
- },
99
- "gpu-3": {
100
- "pid": 18743,
101
- "returncode": 1
102
- },
103
- "gpu-4": {
104
- "pid": 18744,
105
- "returncode": 1
106
- },
107
- "gpu-5": {
108
- "pid": 18745,
109
- "returncode": 1
110
- }
111
- }
112
  }
 
1
  {
2
+ "utc": "2026-10-25T04:54:04Z",
3
+ "stage": "downloading_extracting_global_style1",
4
+ "verified": 26,
5
  "counts": {
6
+ "26b03a8ae47d": 1,
7
+ "4744afcbd909": 1,
8
+ "5501b7377488": 1,
9
+ "ef610916460f": 1,
10
+ "2cb8a9c29e3c": 1,
11
+ "3ac416bb5d5d": 1,
12
+ "aceae18cfd54": 1,
13
+ "09229cb3538e": 1,
14
+ "9fd740550a13": 1,
15
+ "c44e535bbe8e": 1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  "0972e1eed1b3": 1,
17
+ "182ecc60160c": 1,
18
+ "305681c6a53f": 1,
 
 
 
 
19
  "cace0fd21b19": 1,
20
  "ec2035ada05d": 1,
21
+ "0bee0e7e6dc5": 1,
 
22
  "18af27ddab58": 1,
 
23
  "52545659e5cb": 1,
24
  "5dff93f3a267": 1,
25
+ "85246a0d9ced": 1,
 
 
 
 
26
  "0fee9b184beb": 1,
27
+ "194290896821": 1,
 
 
28
  "526f7f26e7a6": 1,
29
+ "a78ae8b77085": 1,
30
+ "cfdb284d6b07": 1,
31
+ "ee3d28fd4cc8": 1
 
 
 
 
32
  },
33
  "statuses": {
34
+ "reject": 4,
35
+ "verified": 26
 
36
  },
37
+ "root_free_bytes": 2129041768448,
38
+ "archives_extracted": [],
39
+ "processes": {},
40
+ "archive_download_bytes": 13119782912
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }