Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/aienux/connector/runner/40job.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / aienux / connector / runner / 40job.om` 333 lines ยท 5857 bytes Raw Blame History 1 note runner/40job.om -- one job: ask the hub, check the compiler, fetch the record, run the cell, 2 note sign and post the result. Run by a worker process the supervisor forks for each cycle. 3 4 text rtnext "next" 5 text rtnonce "nonce" 6 text rtokjob "ipcc1 ok job\n" 7 text rtoknone "ipcc1 ok none\n" 8 text rtjobn "job" 9 text rtpartn "part" 10 text rtcompn "compiler" 11 text rtbinn "binary" 12 text rtoutn "stdout" 13 text rtexitn "exit" 14 text rtresn "result" 15 text rtwork "work" 16 text rtmagic "IPSLV001" 17 text rtlhub "hub: " 18 text rtlnone "no work\n" 19 text rtlpin "refused: the job names a compiler other than the pinned omc `3ad9f10f`\n" 20 text rtlomc "refused: bin/omc is not the pinned compiler; run join again\n" 21 text rtlrec "refused: the record is missing, is not the revision the job names, or is not a part\n" 22 text rtljd "error: could not make the job directory\n" 23 text rtlcell "error: the cell could not start a stage\n" 24 text rtlres "result " 25 text rtlsign "error: could not sign\n" 26 text rtlnet "error: hub not reachable, status " 27 text rtlarr " -> " 28 text rtxneg "-" 29 text rtokcnt "ipcc1 ok counted\n" 30 text rtokst "ipcc1 ok stored\n" 31 text rtlcellp "the cell could not start on this computer (see the result above); checks pause for an hour. Run: interplane-runner selftest\n" 32 33 note r_logt: " " on stdout (the log when running in the background) 34 fn r_logt to void 35 r_num ulong div realns `1000000000` 36 r_say rtsp 37 end 38 39 fn r_lognet s long to void 40 r_logt 41 r_say rtlnet 42 if lt s 0 43 r_say rtxneg 44 r_num ulong neg s 45 else 46 r_num ulong s 47 end 48 r_say rtnl 49 end 50 51 note r_ask: "next"; 0 with the job in rjf, 1 no work, 2 refused or error 52 fn r_ask to ulong 53 nb = new uchar 16 0 54 nh = new uchar 32 0 55 j = new uchar 32 0 56 p = new uchar 64 0 57 c = new uchar 64 0 58 r_mbeg rtnext 59 r_mkey 60 r_mtime 61 x = random nb 0 16 0 62 if ne x 16 63 ret 2 64 end 65 k = r_hex nb nh 0 66 r_mline rtnonce nh 67 if not r_msign 68 r_logt 69 r_say rtlsign 70 ret 2 71 end 72 s = r_post 73 if lt s 0 74 r_lognet s 75 ret 2 76 end 77 if r_rspis rtoknone 78 ret 1 79 end 80 if not r_rspis rtokjob 81 r_logt 82 r_say rtlhub 83 r_rspline 84 r_say rtnl 85 ret 2 86 end 87 ok = and and r_rspfld rtjobn j r_rspfld rtpartn p r_rspfld rtcompn c 88 if not ok 89 ret 2 90 end 91 if not and and r_ishex j r_ishex p r_ishex c 92 ret 2 93 end 94 for i ulong 32 95 put rjf add rfjob i get j i 96 end 97 for i ulong 64 98 put rjf add rfpart i get p i 99 put rjf add rfcomp i get c i 100 end 101 ret 0 102 end 103 104 note r_jfeq: rjf[o, o+len t) equals t 105 fn r_jfeq o ulong t view uchar * to bool 106 for i ulong len t bound 256 107 if ne get rjf add o i get t i 108 ret false 109 end 110 end 111 ret true 112 end 113 114 note r_omcok: /bin/omc hashes to the pin 115 fn r_omcok to bool 116 h = new uchar 32 0 117 x = new uchar 64 0 118 n = r_path rtomc 119 if not r_fsha h 120 ret false 121 end 122 k = r_hex h x 0 123 ret r_eq x rtpin 124 end 125 126 note r_fetch: GET /salvage//record into rrsp; its SHA-256 must be the part id and it must 127 note parse as a part record (IPSLV001, kind 2, twelve field lengths that add up exactly); 128 note sets the source and stdin field offsets 129 fn r_fetch to bool 130 pth = new uchar 128 0 131 p = new uchar 64 0 132 k = r_cp pth 0 rtsalv 133 for i ulong 64 134 put p i get rjf add rfpart i 135 end 136 k = r_cp pth k p 137 k = r_cp pth k rtrecs 138 put rgv rpost 0 139 s = r_call part pth 0 k 140 if ne s 200 141 if ne s 404 142 r_lognet s 143 end 144 ret false 145 end 146 ret r_recok p 147 end 148 149 fn r_recok p view uchar * to bool 150 b = new uchar 65536 0 151 h = new uchar 32 0 152 x = new uchar 64 0 153 n = get rgv rrspl 154 for i ulong n bound 65536 155 put b i get rrsp i 156 end 157 r_sha part b 0 n h 158 k = r_hex h x 0 159 if not r_eq x p 160 ret false 161 end 162 if lt n 64 163 ret false 164 end 165 if not r_eq part b 0 8 rtmagic 166 ret false 167 end 168 if ne get b 8 2 169 ret false 170 end 171 for i ulong 7 172 if ne get b add 9 i 0 173 ret false 174 end 175 end 176 o = ulong 64 177 for f ulong 12 178 l = r_u32 b add 16 mul f 4 179 if gt l n 180 ret false 181 end 182 if eq f 5 183 put rgv rsrco o 184 put rgv rsrcn l 185 end 186 if eq f 7 187 put rgv rstio o 188 put rgv rstin l 189 end 190 o = add o l 191 end 192 ret eq o n 193 end 194 195 note r_rspfile: rrsp[o, o+n) into the new job file nm 196 fn r_rspfile nm view uchar * o ulong n ulong to bool 197 b = new uchar 65536 0 198 for i ulong n bound 65536 199 put b i get rrsp add o i 200 end 201 k = r_jpath nm 202 ret r_wr part b 0 n rfonew 384 203 end 204 205 note r_jdir: rjd = /work/, a new 0700 directory 206 fn r_jdir nm view uchar * to bool 207 q = new uchar 4100 0 208 n = r_path rtwork 209 r = makedir rph 0 n 448 210 if and lt r 0 ne r -17 211 ret false 212 end 213 p = new uchar 4100 0 214 pl = r_phcp p 215 k = r_join part p 0 pl nm q 216 if eq k 0 217 ret false 218 end 219 x = r_rmtree part q 0 k 220 r = makedir q 0 k 448 221 if lt r 0 222 ret false 223 end 224 for i ulong k bound 4100 225 put rjd i get q i 226 end 227 put rgv rjdl k 228 ret true 229 end 230 231 fn r_jdel to void 232 q = new uchar 4100 0 233 n = get rgv rjdl 234 for i ulong n bound 4100 235 put q i get rjd i 236 end 237 x = r_rmtree part q 0 n 238 end 239 240 note r_result: sign and post the result in rjf; 0 counted, 2 refused or error 241 fn r_result to ulong 242 r_mbeg rtresn 243 r_mkey 244 r_mjf rtjobn rfjob 32 245 r_mjf rtpartn rfpart 64 246 r_mjf rtcompn rfcomp 64 247 r_mjf rtbinn rfbin 64 248 r_mjf rtoutn rfout 64 249 r_mjf rtexitn rfexit get rgv rexl 250 r_mtime 251 if not r_msign 252 r_logt 253 r_say rtlsign 254 ret 2 255 end 256 s = r_post 257 r_logt 258 r_say rtlres 259 r_jfsay rfpart 64 260 r_say rtsp 261 r_jfsay rfexit get rgv rexl 262 r_say rtlarr 263 if lt s 0 264 r_say rtxneg 265 r_num ulong neg s 266 r_say rtnl 267 ret 2 268 end 269 r_rspline 270 r_say rtnl 271 if r_rspis rtokcnt 272 ret 0 273 end 274 if r_rspis rtokst 275 ret 3 276 end 277 ret 2 278 end 279 280 fn r_jfsay o ulong n ulong to void 281 d = new uchar 256 0 282 for i ulong n bound 256 283 put d i get rjf add o i 284 end 285 w = write 1 d 0 n 286 end 287 288 note r_job: one whole cycle; 0 a result was counted, 1 no work, 2 refused or error 289 fn r_job to ulong 290 j = new uchar 32 0 291 a = r_ask 292 if eq a 1 293 r_logt 294 r_say rtlnone 295 end 296 if ne a 0 297 ret a 298 end 299 if not r_jfeq rfcomp rtpin 300 r_logt 301 r_say rtlpin 302 ret 2 303 end 304 if not r_omcok 305 r_logt 306 r_say rtlomc 307 ret 2 308 end 309 if not r_fetch 310 r_logt 311 r_say rtlrec 312 ret 2 313 end 314 for i ulong 32 315 put j i get rjf add rfjob i 316 end 317 if not r_jdir j 318 r_logt 319 r_say rtljd 320 ret 2 321 end 322 ok = and r_rspfile rtsrc get rgv rsrco get rgv rsrcn r_rspfile rtsin get rgv rstio get rgv rstin 323 if ok 324 ok = r_check 325 end 326 r_jdel 327 if not ok 328 r_logt 329 r_say rtlcell 330 ret 2 331 end 332 ret r_result 333 end