junidude14 commited on
Commit
a8d1894
·
verified ·
1 Parent(s): 1a75018

Archive 4 checkpoints (1-4)

Browse files
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/SOURCE_MAP.json ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tools/campaign.py",
4
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/0/campaign.py",
5
+ "sha256": "c0ed2ddf6ab13f4af1cd6bc785e52037a3e814b0af60965a0fef74d0d971adec"
6
+ },
7
+ {
8
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tools/runtime.py",
9
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/1/runtime.py",
10
+ "sha256": "67ea571aa077aa1d17131a9d5ade3eadc8c310620d8a358be81d3f69e065a7aa"
11
+ },
12
+ {
13
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tools/support_input_isolation.py",
14
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/2/support_input_isolation.py",
15
+ "sha256": "762f5f7bbf908c478544b0c5c05a8fbf6c3bf63eff6a2d7af88105473c1c20a2"
16
+ },
17
+ {
18
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tools/two_host_resume.py",
19
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/3/two_host_resume.py",
20
+ "sha256": "606b8de898959dc371904c2f1facde4974ebdf792412fcbe6b5ee1db9904cbd1"
21
+ },
22
+ {
23
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tests/test_campaign.py",
24
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/4/test_campaign.py",
25
+ "sha256": "ab621bcc280e50a9e3ca1feab4643fcd3658bba53ff7d7c133cc36bda692ba4b"
26
+ },
27
+ {
28
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tests/test_runtime.py",
29
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/5/test_runtime.py",
30
+ "sha256": "66523fc94de255d13066fa85c4aabb1efa26304060d0de5f11205e55c8f041d0"
31
+ },
32
+ {
33
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tests/test_runtime_recovery.py",
34
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/6/test_runtime_recovery.py",
35
+ "sha256": "fe6d4ee7facac1221d948675dcf024434b75f948575add930e5638b888ea78e9"
36
+ },
37
+ {
38
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tests/test_support_input_isolation.py",
39
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/7/test_support_input_isolation.py",
40
+ "sha256": "483a022a2de95d975f1546f9c7d3fcc049a5d6ef205815ba0a8b4772580dc6f3"
41
+ },
42
+ {
43
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/tests/test_two_host_resume.py",
44
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/8/test_two_host_resume.py",
45
+ "sha256": "b5b64587d36add74e79c9fdb8df4c185fa111d78a1b8a70ef712ee5dc919974e"
46
+ },
47
+ {
48
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/rebind_sources_20261012.py",
49
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/9/rebind_sources_20261012.py",
50
+ "sha256": "8125a9ef88ef56e89462f816666d83b93bd68452df534a8074271beaed34a1a7"
51
+ },
52
+ {
53
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/SOURCE_REUSE.json",
54
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/10/SOURCE_REUSE.json",
55
+ "sha256": "5c0f005f2fb8afe0369a2fa06b1f3a21b89bd2566ccd7ad6d1844b29e2ac8359"
56
+ },
57
+ {
58
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/two_host/REMOTE_SOURCE_VERIFICATION.json",
59
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/11/REMOTE_SOURCE_VERIFICATION.json",
60
+ "sha256": "9ef066e91a5a39dcff0b43ced1431a9c6be07ddcdadacb15d2b4dabbc42e581a"
61
+ },
62
+ {
63
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/two_host/STAGED_SOURCE_VERIFICATION.json",
64
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/12/STAGED_SOURCE_VERIFICATION.json",
65
+ "sha256": "3a5da9716560c7e6b2181c36df9f57f919f7e54f3ab1c8761d08e376e5dc879a"
66
+ },
67
+ {
68
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/two_host/config.json",
69
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/13/config.json",
70
+ "sha256": "56c62625359d63a2944984a4f60fd4b4b1aabc621826b1105f09be0e06a5fdd9"
71
+ },
72
+ {
73
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/two_host/execution_map_server2.json",
74
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/14/execution_map_server2.json",
75
+ "sha256": "1da78d904304463648215f7014539d0c56c1f4c302a36a642eedcff3b0460b2c"
76
+ },
77
+ {
78
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/20261012T141153Z-manual-reboot/RECOVERY.json",
79
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/15/RECOVERY.json",
80
+ "sha256": "bceb2f1f6a12ad9387565266c313de87b56681d598ea34e398867ed3c3ced2b4"
81
+ },
82
+ {
83
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/tools/ft_sdd.py",
84
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/16/ft_sdd.py",
85
+ "sha256": "9333b296acfb58e52ebe10e30c3334250bf2ce8c3dbfd446d65726f6b8da4abb"
86
+ },
87
+ {
88
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927/scsemi/tools/prepare_draw_inputs.py",
89
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/17/prepare_draw_inputs.py",
90
+ "sha256": "debff837167b4fd9e5fea4c14beb1c4c56cb3baf476150b08396a3eee421d02a"
91
+ },
92
+ {
93
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-train-proof.json",
94
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/18/immicro-healthy-fold1-n5-train-proof.json",
95
+ "sha256": "abc5c91549a18877b3dc9569d67aad489310c4c618c83f4e7dc8f337566e042e"
96
+ },
97
+ {
98
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-train-proof.json",
99
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/19/immicro-healthy-fold0-n5-train-proof.json",
100
+ "sha256": "32fad796b963affb2e3fcdf1248f22804b0c595678305846477c02e47636c16c"
101
+ },
102
+ {
103
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-train.json",
104
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/20/immicro-healthy-fold1-n5-train.json",
105
+ "sha256": "752d2bf7c1ed36ee224cf8d4ec4a5c36f3ec3258fc0d044c377d151886403b48"
106
+ },
107
+ {
108
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-scinputs-proof.json",
109
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/21/immicro-healthy-fold0-n5-scinputs-proof.json",
110
+ "sha256": "678c157b9f907b853276212437b95854bc5dfee5a58a29096c8df4c8d0bbb8ca"
111
+ },
112
+ {
113
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-train.json",
114
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/22/immicro-healthy-fold0-n5-train.json",
115
+ "sha256": "a5adc14fe5a2bce4f9aaaaae6a3cfa087e13f91ba8bf7972eb937f1508cf3714"
116
+ },
117
+ {
118
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-scinputs-proof.json",
119
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/23/immicro-healthy-fold1-n5-scinputs-proof.json",
120
+ "sha256": "482e5417167f4f67b0bc00d4ed1cc1972fa4602757b700767cd1d881485e89e0"
121
+ },
122
+ {
123
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold1-n5-scinputs.json",
124
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/24/immicro-healthy-fold1-n5-scinputs.json",
125
+ "sha256": "feeeef8b6e7a120c879344084e58b646f2c590b693895dba0313d0fadb5cd278"
126
+ },
127
+ {
128
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/recoveries/source_reuse_20261012/immicro-healthy-fold0-n5-scinputs.json",
129
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/25/immicro-healthy-fold0-n5-scinputs.json",
130
+ "sha256": "2888679e086cfd188852113c98c28fba592220a109223c78fba5cf56392a3b8c"
131
+ },
132
+ {
133
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold0/n5/REPLAY.json",
134
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/26/REPLAY.json",
135
+ "sha256": "bdb8576d6558943f4886c3fe063445a129a4c2c04a3adb8d11bfb869f04c8c82"
136
+ },
137
+ {
138
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold1/n5/REPLAY.json",
139
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/27/REPLAY.json",
140
+ "sha256": "baa4653814d2a151ab0f55830e57b4a6a30d47edcecebaefb727c968cb495609"
141
+ },
142
+ {
143
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold0/n5/ISOLATION.json",
144
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/28/ISOLATION.json",
145
+ "sha256": "aa3e1cafad1d953458a459522aa2395b673e864caa8829bc514db04b272b831c"
146
+ },
147
+ {
148
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/isolated/immicro/healthy/fold1/n5/ISOLATION.json",
149
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/29/ISOLATION.json",
150
+ "sha256": "0a50a995963f589387a27142c14cc2933c216899e89f794f8bd1e47bff1334db"
151
+ },
152
+ {
153
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/backups/recovery_input_isolation_20261012T142024Z/plans/paper_figures_strictpairs_20261012/tools/support_input_isolation.py",
154
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/30/support_input_isolation.py",
155
+ "sha256": "1e383c79085c6d20afd839b401ec2e321df3d535d3d1b5552ba9f0e59ba033af"
156
+ },
157
+ {
158
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/backups/recovery_input_isolation_20261012T142024Z/plans/paired_finetune_intradataset_20260927/tools/ft_sdd.py",
159
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/31/ft_sdd.py",
160
+ "sha256": "e7f3d38b65932ffe99292a8841a15eb9e7cce205afec1de6b34b59a06731b82d"
161
+ },
162
+ {
163
+ "original": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/backups/recovery_input_isolation_20261012T142024Z/plans/paired_finetune_intradataset_20260927/scsemi/tools/prepare_draw_inputs.py",
164
+ "snapshot": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/32/prepare_draw_inputs.py",
165
+ "sha256": "b11b9f206a04fdac99dc489a8387647f0a334a59d5761a0c1bd964301933da8f"
166
+ }
167
+ ]
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/32/prepare_draw_inputs.py ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ """Build scSemiProfiler inputs for one paired split (CPU only).
3
+
4
+ Representatives = every usable row of the split's training donors (paired sc + real bulk).
5
+ Targets = the split's test rows (real bulk only; their cells are never read here).
6
+
7
+ --mode fewshot --draw j : training donors = data/<ds>/fewshot_n5/draw<j>/train_donors.txt,
8
+ targets = draw<j>/test_samples.txt, condition = draw<j>/test_raw.npz
9
+ --mode cv --fold k : training donors = every usable donor not in fold k (inner-val donors included),
10
+ targets = fold k's rows, condition = data/<ds>/fold<k>/test_raw.npz
11
+ --mode budget --fold k --n N (added 2026-10-02): representatives = exactly the rows LoRA lora_n<N> of fold k saw,
12
+ runs/<ds>/fold<k>/lora_n<N>/RUN.json train_rows + inner_val_rows (checked against
13
+ data/<ds>/CAL_BUDGET.json fit_sample_ids when present); targets = fold k's rows (checked
14
+ against the run's test_rows_never_loaded_for_training); condition = fold<k>/test_raw.npz.
15
+ The manifest also records target_donors (used by run_scsemi_paired.py --reuse-from).
16
+ --check-only (added 2026-10-02): build and check everything (split, genes, cells, depth, condition), write
17
+ nothing under --work; print the summary (and the representative / target lists to
18
+ --check-out if given). Without it the builder behaves exactly as before.
19
+
20
+ Modeled genes = final 6k panel genes measured in the bulk of every representative and target row AND in the
21
+ single cells of every representative row (features.npz bulk_valid / sc_valid). No target single-cell mask,
22
+ depth or cell count enters.
23
+
24
+ Writes <work>/inputs/:
25
+ bulk.h5ad raw bulk counts (float64) of reps + targets on the modeled genes, obs['sample_ids'],
26
+ rows in features.npz order; upstream initsetup(normed=False) library-normalises + log1p's it
27
+ rep_sc.h5ad raw UMI counts (float32 CSR) of every representative cell on the modeled genes,
28
+ obs['sample_ids'] = the representative row's sample id; upstream scprocess(normed=False)
29
+ inputs_manifest.json rows, genes, depth rule, source hashes
30
+ """
31
+ from __future__ import annotations
32
+
33
+ import argparse
34
+ import hashlib
35
+ import json
36
+ import os
37
+ import sys
38
+ from datetime import datetime, timezone
39
+ from pathlib import Path
40
+
41
+ if os.environ.get("CUDA_VISIBLE_DEVICES") != "":
42
+ raise SystemExit("run with CUDA_VISIBLE_DEVICES=''")
43
+
44
+ import numpy as np
45
+ import pandas as pd
46
+ import scipy.sparse as sp
47
+
48
+ TASK = Path("/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paired_finetune_intradataset_20260927")
49
+ HERE = TASK / "scsemi"
50
+ sys.path.insert(0, str(TASK / "tools"))
51
+ import prepare_dataset as PD # noqa: E402 (the benchmark's own loader: bulk_raw with unmeasured NaN -> 0, masks, use)
52
+
53
+ SEED = 20260927
54
+
55
+
56
+ def sha(path: Path) -> str:
57
+ h = hashlib.sha256()
58
+ with open(path, "rb") as f:
59
+ for block in iter(lambda: f.read(1 << 24), b""):
60
+ h.update(block)
61
+ return h.hexdigest()
62
+
63
+
64
+ def split_rows(ds: str, mode: str, j: int, sample_ids: np.ndarray, folds: pd.DataFrame,
65
+ n: int | None = None, support_manifest: Path | None = None) -> dict:
66
+ data = TASK / "data" / ds
67
+ usable = folds["fold"].to_numpy() >= 0
68
+ donors = folds["donor_id"].astype(str).to_numpy()
69
+ extra = {}
70
+ if support_manifest is not None:
71
+ strict_tools = TASK.parents[1] / "plans/paper_figures_strictpairs_20261012/tools"
72
+ sys.path.insert(0, str(strict_tools))
73
+ from support_manifest import load_manifest, select_rows
74
+ m = load_manifest(support_manifest, folds)
75
+ if m["cohort"] != ds:
76
+ raise SystemExit("support cohort differs from dataset")
77
+ rep, tgt = select_rows(m, folds)
78
+ rel = support_manifest.resolve().parent.relative_to(
79
+ TASK.parents[1] / "plans/paper_figures_strictpairs_20261012/protocol/splits")
80
+ cond = TASK.parents[1] / "plans/paper_figures_strictpairs_20261012/data" / rel / "test_raw.npz"
81
+ return {"rep": rep, "tgt": tgt, "train_donors": m["train_donor_ids"],
82
+ "test": m["test_sample_ids"], "condition": cond,
83
+ "sources": {"support.json": support_manifest},
84
+ "support_sha256": m["sha256"], "target_donors": m["test_donor_ids"]}
85
+ if mode == "fewshot":
86
+ dd = data / "fewshot_n5" / f"draw{j}"
87
+ train_donors = [x.strip() for x in (dd / "train_donors.txt").read_text().splitlines() if x.strip()]
88
+ test = [x.strip() for x in (dd / "test_samples.txt").read_text().splitlines() if x.strip()]
89
+ cond = dd / "test_raw.npz"
90
+ sources = {"train_donors.txt": dd / "train_donors.txt", "test_samples.txt": dd / "test_samples.txt"}
91
+ rep = np.flatnonzero(np.isin(donors, train_donors) & usable)
92
+ elif mode == "cv":
93
+ fold = folds["fold"].to_numpy()
94
+ test = sample_ids[fold == j].tolist()
95
+ rep = np.flatnonzero(usable & (fold != j))
96
+ train_donors = sorted(set(donors[rep]))
97
+ cond = data / f"fold{j}" / "test_raw.npz"
98
+ sources = {}
99
+ elif mode == "budget":
100
+ fold = folds["fold"].to_numpy()
101
+ rj = TASK / "runs" / ds / f"fold{j}" / f"lora_n{n}" / "RUN.json"
102
+ run = json.loads(rj.read_text())
103
+ if run["fold"] != j or (run.get("train_subset") or {}).get("train_n") != n:
104
+ raise SystemExit(f"{rj}: not the fold {j} n={n} learning-curve run")
105
+ fit = list(run["train_rows"]) + list(run["inner_val_rows"])
106
+ test = sample_ids[fold == j].tolist()
107
+ if sorted(run["test_rows_never_loaded_for_training"]) != sorted(test):
108
+ raise SystemExit(f"{rj}: its test rows differ from fold {j}'s rows")
109
+ pos = {s: i for i, s in enumerate(sample_ids)}
110
+ if len(set(fit)) != len(fit) or any(s not in pos for s in fit):
111
+ raise SystemExit(f"{rj}: duplicate or unknown fit rows")
112
+ rep = np.asarray(sorted(pos[s] for s in fit), dtype=np.int64)
113
+ if not (usable[rep] & (fold[rep] != j)).all():
114
+ raise SystemExit(f"{rj}: a fit row is unusable or in fold {j}")
115
+ cb = data / "CAL_BUDGET.json"
116
+ if cb.exists():
117
+ e = json.loads(cb.read_text())["folds"][str(j)]["n"][str(n)]
118
+ if sorted(e["fit_sample_ids"]) != sorted(fit) or e["lora_checkpoint_sha256"] != run["checkpoint_sha256"]:
119
+ raise SystemExit(f"{cb}: fold {j} n={n} fit rows / LoRA checkpoint differ from {rj}")
120
+ train_donors = sorted(set(donors[rep]))
121
+ cond = data / f"fold{j}" / "test_raw.npz"
122
+ sources = {"lora_RUN.json": rj, **({"CAL_BUDGET.json": cb} if cb.exists() else {})}
123
+ extra = {"budget": {"n": int(n), "fold": int(j), "lora_run": str(rj), "lora_checkpoint_sha256": run["checkpoint_sha256"],
124
+ "n_train_rows": len(run["train_rows"]), "n_inner_val_rows": len(run["inner_val_rows"]),
125
+ "train_rows": list(run["train_rows"]), "inner_val_rows": list(run["inner_val_rows"])}}
126
+ else:
127
+ raise SystemExit(f"unknown mode {mode}")
128
+ pos = {s: i for i, s in enumerate(sample_ids)}
129
+ miss = [s for s in test if s not in pos]
130
+ if miss:
131
+ raise SystemExit(f"test samples not in features.npz: {miss[:5]}")
132
+ tgt = np.asarray([pos[s] for s in test], dtype=np.int64)
133
+ if not usable[tgt].all():
134
+ raise SystemExit("a test row is not usable (fold -1)")
135
+ if set(donors[rep]) & set(donors[tgt]):
136
+ raise SystemExit("a donor is both representative and target")
137
+ if len(set(test)) != len(test):
138
+ raise SystemExit("duplicate test samples")
139
+ return {"rep": rep, "tgt": tgt, "train_donors": train_donors, "test": test, "condition": cond, "sources": sources,
140
+ **extra}
141
+
142
+
143
+ def main(argv=None) -> int:
144
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
145
+ ap.add_argument("--dataset", required=True)
146
+ ap.add_argument("--mode", choices=["fewshot", "cv", "budget"], default="fewshot")
147
+ ap.add_argument("--draw", type=int, help="fewshot draw index")
148
+ ap.add_argument("--fold", type=int, help="cv / budget fold index")
149
+ ap.add_argument("--n", type=int, help="budget: the LoRA learning-curve n (runs/<ds>/fold<k>/lora_n<n>)")
150
+ ap.add_argument("--work", type=Path, required=True)
151
+ ap.add_argument("--smoke-reps", type=int, default=0, help="SMOKE ONLY: keep the first N representative rows")
152
+ ap.add_argument("--smoke-cells", type=int, default=0, help="SMOKE ONLY: at most N cells per representative")
153
+ ap.add_argument("--smoke-targets", default="", help="SMOKE ONLY: comma list of target sample ids")
154
+ ap.add_argument("--smoke-rep-ids", default="", help="SMOKE ONLY: comma list of representative sample ids to keep")
155
+ ap.add_argument("--check-only", action="store_true", help="dry run: check everything, write nothing under --work")
156
+ ap.add_argument("--check-out", type=Path, default=None, help="--check-only: write the split summary JSON here")
157
+ ap.add_argument("--support-manifest", type=Path, default=None,
158
+ help="strict support.json; representatives are its exact n sample IDs")
159
+ a = ap.parse_args(argv)
160
+ if a.support_manifest is not None:
161
+ if a.draw is not None or a.fold is not None or a.n is not None:
162
+ raise SystemExit("--support-manifest cannot be combined with --draw/--fold/--n")
163
+ a.mode = "strict"
164
+ j = 0
165
+ else:
166
+ j = a.draw if a.mode == "fewshot" else a.fold
167
+ if j is None:
168
+ raise SystemExit("--draw (fewshot) or --fold (cv, budget) required")
169
+ if (a.mode == "budget") != (a.n is not None):
170
+ raise SystemExit("--n is required with --mode budget and only valid there")
171
+ smoke = bool(a.smoke_reps or a.smoke_cells or a.smoke_targets or a.smoke_rep_ids)
172
+ if a.support_manifest is not None and smoke:
173
+ raise SystemExit("strict support forbids smoke subsetting")
174
+ work = a.work.resolve()
175
+ if smoke and "/scsemi/smoke/" not in str(work) + "/":
176
+ raise SystemExit("smoke subsetting only under scsemi/smoke/")
177
+ out = work / "inputs"
178
+ if not a.check_only:
179
+ if (out / "inputs_manifest.json").exists():
180
+ raise SystemExit(f"{out}/inputs_manifest.json exists; inputs are immutable (preserve and inspect)")
181
+ out.mkdir(parents=True, exist_ok=True)
182
+ data = TASK / "data" / a.dataset
183
+ d = PD.load(data)
184
+ folds = pd.read_csv(data / "folds.csv")
185
+ if not np.array_equal(folds["sample_id"].astype(str).to_numpy(), d["sample_ids"]):
186
+ raise SystemExit("folds.csv rows differ from features.npz")
187
+ s = split_rows(a.dataset, a.mode, j, d["sample_ids"], folds, n=a.n,
188
+ support_manifest=a.support_manifest)
189
+ rep, tgt = s["rep"], s["tgt"]
190
+ if a.smoke_rep_ids:
191
+ keep_r = set(a.smoke_rep_ids.split(","))
192
+ rep = np.asarray([r for r in rep if d["sample_ids"][r] in keep_r], dtype=np.int64)
193
+ if a.smoke_reps:
194
+ rep = rep[: a.smoke_reps]
195
+ if a.smoke_targets:
196
+ keep = set(a.smoke_targets.split(","))
197
+ tgt = np.asarray([t for t in tgt if d["sample_ids"][t] in keep], dtype=np.int64)
198
+ s["test"] = [x for x in s["test"] if x in keep]
199
+ if a.mode == "fewshot" and not smoke:
200
+ usable = np.flatnonzero(folds["fold"].to_numpy() >= 0)
201
+ if set(rep.tolist()) | set(tgt.tolist()) != set(usable.tolist()):
202
+ raise SystemExit("representatives + targets do not cover the usable rows")
203
+ # modeled genes
204
+ z = np.load(data / "cells_panel6k.npz", allow_pickle=False)
205
+ panel = z["panel_gene_ids"].astype(str)
206
+ gpos = {g: i for i, g in enumerate(d["gene_ids"])}
207
+ pcanon = np.asarray([gpos[g] for g in panel], dtype=np.int64)
208
+ rows = np.sort(np.concatenate([rep, tgt]))
209
+ bulk_ok = d["bulk_valid"][rows][:, pcanon].all(0)
210
+ sc_ok = d["sc_valid"][rep][:, pcanon].all(0)
211
+ model_pidx = np.flatnonzero(bulk_ok & sc_ok)
212
+ genes = panel[model_pidx]
213
+ if genes.size < 1000:
214
+ raise SystemExit(f"only {genes.size} modeled genes")
215
+ # scorer's scoring genes (all rows of the dataset) for the record
216
+ score_mask = d["bulk_valid"][:, pcanon].all(0) & d["sc_valid"][:, pcanon].all(0)
217
+ # bulk
218
+ import anndata as ad
219
+ B = d["bulk"][rows][:, pcanon[model_pidx]].astype(np.float64)
220
+ if not np.isfinite(B).all() or (B < 0).any():
221
+ raise SystemExit("non-finite or negative bulk on the modeled genes")
222
+ if (B.sum(1) <= 0).any():
223
+ raise SystemExit("a bulk row has no counts on the modeled genes")
224
+ sym = pd.read_csv(TASK.parents[1] / "artifacts/panel_ladder_floor01_1m_20260923/tiers/6k/selected_genes.csv")
225
+ sym = sym.set_index("gene_id").gene_symbol.astype(str)
226
+ var = pd.DataFrame({"gene_symbol": sym.reindex(genes).to_numpy()}, index=pd.Index(genes, name="gene_id"))
227
+ obs_b = pd.DataFrame({"sample_ids": d["sample_ids"][rows], "donor_id": d["donor_ids"][rows],
228
+ "group": d["groups"][rows], "role": np.where(np.isin(rows, rep), "representative", "target")},
229
+ index=pd.Index(d["sample_ids"][rows], name="obs"))
230
+ if not a.check_only:
231
+ ad.AnnData(X=B, obs=obs_b, var=var).write_h5ad(out / "bulk.h5ad")
232
+ # representative cells
233
+ X = sp.csr_matrix((z["data"], z["indices"], z["indptr"]), shape=tuple(int(x) for x in z["shape"]))
234
+ rs = np.asarray(z["row_sample"], dtype=np.int64)
235
+ blocks, obs_rows, per_rep = [], [], []
236
+ rng = np.random.default_rng(SEED)
237
+ for r in rep:
238
+ cells = np.flatnonzero(rs == r)
239
+ if a.smoke_cells and cells.size > a.smoke_cells:
240
+ cells = np.sort(rng.choice(cells, a.smoke_cells, replace=False))
241
+ Xr = X[cells][:, model_pidx].tocsr().astype(np.float32)
242
+ lib = np.asarray(Xr.sum(1)).ravel()
243
+ if (lib <= 0).any():
244
+ raise SystemExit(f"{d['sample_ids'][r]}: {int((lib <= 0).sum())} cells without counts on the modeled genes")
245
+ blocks.append(Xr)
246
+ obs_rows.append(pd.DataFrame({"sample_ids": d["sample_ids"][r], "donor_id": d["donor_ids"][r],
247
+ "source_cell_row": cells}))
248
+ per_rep.append({"sample_id": str(d["sample_ids"][r]), "donor_id": str(d["donor_ids"][r]),
249
+ "group": str(d["groups"][r]), "n_cells": int(cells.size),
250
+ "median_umi_modeled_genes": float(np.median(lib))})
251
+ Xs = sp.vstack(blocks, format="csr")
252
+ obs_s = pd.concat(obs_rows, ignore_index=True)
253
+ obs_s.index = pd.Index([f"{a_}|{b_}" for a_, b_ in zip(obs_s.sample_ids, obs_s.source_cell_row)], name="cell")
254
+ if not a.check_only:
255
+ ad.AnnData(X=Xs, obs=obs_s, var=var.copy()).write_h5ad(out / "rep_sc.h5ad")
256
+ lib_all = np.asarray(Xs.sum(1)).ravel()
257
+ depth = float(np.median(lib_all))
258
+ cond = s["condition"]
259
+ man = {
260
+ "schema": "scsemi_paired.inputs.v1", "written_utc": datetime.now(timezone.utc).isoformat(),
261
+ "dataset": a.dataset, "mode": a.mode, "split": j, "smoke": smoke,
262
+ "smoke_settings": {"reps": a.smoke_reps, "cells": a.smoke_cells, "targets": a.smoke_targets,
263
+ "rep_ids": a.smoke_rep_ids} if smoke else None,
264
+ "train_donors": s["train_donors"],
265
+ "representatives": per_rep, "targets": [str(x) for x in d["sample_ids"][tgt]],
266
+ "target_order_test_samples": s["test"],
267
+ "bulk_row_order": [str(x) for x in d["sample_ids"][rows]],
268
+ "n_representatives": int(rep.size), "n_targets": int(tgt.size), "n_rep_cells": int(Xs.shape[0]),
269
+ "modeled_genes": {"n": int(genes.size), "gene_ids": genes.tolist(), "panel_index": model_pidx.tolist(),
270
+ "rule": "6k panel genes with bulk_valid in every rep+target row and sc_valid in every rep row",
271
+ "equals_scorer_scoring_genes": bool(np.array_equal(model_pidx, np.flatnonzero(score_mask))),
272
+ "n_scorer_scoring_genes": int(score_mask.sum())},
273
+ "depth": {"value": depth, "rule": "median over all representative cells (all rows of the training donors) of the "
274
+ "per-cell UMI sum on the modeled genes; every generated cell is scaled to this expected library",
275
+ "n_cells": int(lib_all.size)},
276
+ "condition_npz": str(cond), "condition_sha256": sha(cond),
277
+ "sources": {"features.npz": sha(data / "features.npz"), "folds.csv": sha(data / "folds.csv"),
278
+ "cells_panel6k.npz": sha(data / "cells_panel6k.npz"),
279
+ **{k: sha(v) for k, v in s["sources"].items()}},
280
+ "files": ({"bulk.h5ad": sha(out / "bulk.h5ad"), "rep_sc.h5ad": sha(out / "rep_sc.h5ad")}
281
+ if not a.check_only else None),
282
+ "builder_sha256": sha(Path(__file__)),
283
+ }
284
+ if a.mode == "strict":
285
+ man["support_sha256"] = s["support_sha256"]
286
+ man["target_donors"] = s["target_donors"]
287
+ if a.mode == "budget":
288
+ man["target_donors"] = sorted({str(x) for x in d["donor_ids"][tgt]})
289
+ man["budget"] = s["budget"]
290
+ with np.load(cond, allow_pickle=False) as cz:
291
+ cond_ids = cz["sample_ids"].astype(str).tolist()
292
+ if not smoke and sorted(cond_ids) != sorted(man["targets"]):
293
+ raise SystemExit("condition NPZ sample_ids differ from the targets")
294
+ man["condition_sample_order"] = cond_ids
295
+ if a.check_only:
296
+ summary = {"dataset": a.dataset, "mode": a.mode, "split": j, "n": a.n, "work": str(work),
297
+ "reps": [r["sample_id"] for r in per_rep], "targets": man["targets"],
298
+ "rep_cells": {r["sample_id"]: r["n_cells"] for r in per_rep}, "n_rep_cells": int(Xs.shape[0]),
299
+ "modeled_genes": int(genes.size), "modeled_panel_index": model_pidx.tolist(),
300
+ "equals_scorer_genes": man["modeled_genes"]["equals_scorer_scoring_genes"],
301
+ "depth": depth, "condition_npz": str(cond), "condition_matches_targets": True,
302
+ "train_donors": s["train_donors"], **({"budget": s["budget"]} if a.mode == "budget" else {})}
303
+ if a.check_out is not None:
304
+ a.check_out.parent.mkdir(parents=True, exist_ok=True)
305
+ a.check_out.write_text(json.dumps(summary, indent=1) + "\n")
306
+ print(json.dumps({k: summary[k] for k in ("dataset", "mode", "split", "n", "n_rep_cells", "modeled_genes",
307
+ "equals_scorer_genes", "depth")} | {"reps": len(summary["reps"]),
308
+ "targets": len(summary["targets"])}))
309
+ return 0
310
+ tmp = out / "inputs_manifest.json.tmp"
311
+ tmp.write_text(json.dumps(man, indent=1) + "\n")
312
+ tmp.replace(out / "inputs_manifest.json")
313
+ print(json.dumps({"dataset": a.dataset, "mode": a.mode, "split": j, "reps": int(rep.size), "targets": int(tgt.size),
314
+ "rep_cells": int(Xs.shape[0]), "modeled_genes": int(genes.size),
315
+ "equals_scorer_genes": man["modeled_genes"]["equals_scorer_scoring_genes"], "depth": depth}))
316
+ return 0
317
+
318
+
319
+ if __name__ == "__main__":
320
+ sys.exit(main())
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/archive_queue/ARCHIVE_RECOVERY_QUEUE.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "first_existing_update": "20261012T130738Z-strictpairs-implementation",
3
+ "first_service": "pbisc-strict-archive-instrumented-resume-20261012.service",
4
+ "updates": [
5
+ {
6
+ "id": "20261012T131501Z-strictpairs-final-caption",
7
+ "request": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T131501Z-strictpairs-final-caption/request.json"
8
+ },
9
+ {
10
+ "id": "20261012T143729Z-strictpairs-recovery-two-host",
11
+ "request": "/home/sj_server_1/PBISC/immun-pbmc-fm/model_8_sparse_data_diffusion/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/request.json"
12
+ }
13
+ ]
14
+ }
paper-releases/pbisc-diffusion/updates/20261012T143729Z-strictpairs-recovery-two-host/diffusion/dataset/server_1/model8/plans/paper_figures_strictpairs_20261012/archive/20261012T143729Z-strictpairs-recovery-two-host/snapshot/archive_queue/finish_recovery_archives.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Finish the explicitly approved archive queue once; no publish retry loop."""
2
+ import json
3
+ from pathlib import Path
4
+ import subprocess
5
+ import sys
6
+ import time
7
+
8
+ ROOT = Path(__file__).resolve().parents[1]
9
+ sys.path.insert(0, str(ROOT / "tools"))
10
+ from runtime import atomic_json, sha256, stamp
11
+
12
+ RELEASE = Path('/home/sj_server_1/PBISC/paper-release-20260928')
13
+ PYTHON = '/home/sj_server_1/miniforge3/bin/python'
14
+ CLI = RELEASE / 'maintenance/update.py'
15
+ STATE = ROOT / 'recoveries/ARCHIVE_RECOVERY_STATUS.json'
16
+
17
+
18
+ def verified(identifier):
19
+ folder = RELEASE / 'maintenance/updates' / identifier
20
+ receipt = folder / 'UPDATE_VERIFIED.json'
21
+ status = folder / 'STATUS.json'
22
+ return receipt.is_file() and status.is_file() and json.loads(status.read_text()).get('phase') == 'verified'
23
+
24
+
25
+ def main():
26
+ queue = json.loads((ROOT / 'recoveries/ARCHIVE_RECOVERY_QUEUE.json').read_text())
27
+ state = {'state': 'waiting_existing_publisher', 'started_at': stamp(), 'completed': []}
28
+ atomic_json(STATE, state)
29
+ try:
30
+ while not verified(queue['first_existing_update']):
31
+ active = subprocess.run(['systemctl', '--user', 'is-active', '--quiet', queue['first_service']])
32
+ if active.returncode:
33
+ raise RuntimeError('existing archive resume stopped without verification; inspect diagnostics')
34
+ time.sleep(15)
35
+ for update in queue['updates']:
36
+ state.update(state='publishing', active=update['id'], updated_at=stamp())
37
+ atomic_json(STATE, state)
38
+ if not verified(update['id']):
39
+ folder = RELEASE / 'maintenance/updates' / update['id']
40
+ if not (folder / 'manifest.json').is_file():
41
+ subprocess.run([PYTHON, str(CLI), 'prepare', '--request', update['request'], '--id', update['id']], check=True)
42
+ subprocess.run([PYTHON, str(CLI), 'publish', update['id'], '--execute'], check=True)
43
+ if not verified(update['id']):
44
+ raise RuntimeError('publisher returned without a verified receipt')
45
+ state['completed'].append(update['id'])
46
+ latest = json.loads((RELEASE / 'LATEST.json').read_text())
47
+ last = queue['updates'][-1]['id']
48
+ receipt = RELEASE / 'maintenance/updates' / last / 'UPDATE_VERIFIED.json'
49
+ if latest['id'] != last or latest['verified_receipt_sha256'] != sha256(receipt):
50
+ raise RuntimeError('archive latest pointer does not match recovery receipt')
51
+ state.update(state='completed', active=None, updated_at=stamp(), latest_id=last)
52
+ atomic_json(STATE, state)
53
+ except BaseException as exc:
54
+ state.update(state='failed_needs_inspection', error=str(exc), updated_at=stamp())
55
+ atomic_json(STATE, state)
56
+ raise
57
+
58
+
59
+ if __name__ == '__main__':
60
+ main()