gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2f986ca32f986ca3Log: RT50 passmre2f986ca3/tools/old-short-ids.hl

1.7 KB

  1. // tools/old-short-ids.hl — mission 060 (tracker.worldapi.org#27), one-off: the old tracker's short ids → data/old-short-ids.json.
  2. // The old export's Show.jsonl carries `id` (5 characters, base62 counter '100jh'…) on 702 of 9,453 shows; the file maps the
  3. // old Mongo `_id` (= our shows' `oldId`, tools/migrate.hl) → that id. shortids.hl reads it at start and gives those shows
  4. // their old id back. Reads only the export (never storage/); the export is on Loreana only, the JSON file goes with the code.
  5. //
  6. // TRACKER_OLD_DATA=/media/STORAGE/projects/old-tracker/mongo-export TRACKER_MIGRATE_TMP=$PWD/.scratch/old-short-ids-tmp \
  7. // TRACKER_OLD_SHORT_IDS=$PWD/data/old-short-ids.json ./bin/hybriel tools/old-short-ids.hl
  8. import { env } from 'hl:proc'
  9. import { writeFile } from 'hl:fs'
  10. import { oidOf, bigLinesOf } from '../lib/export.hl'
  11. oldDir = env('TRACKER_OLD_DATA')
  12. tmpDir = env('TRACKER_MIGRATE_TMP')
  13. outFile = env('TRACKER_OLD_SHORT_IDS')
  14. if (oldDir == null || !oldDir.startsWith('/') || tmpDir == null || !tmpDir.startsWith('/') || outFile == null || !outFile.startsWith('/')) {
  15. hlError('set TRACKER_OLD_DATA (the mongo-export directory), TRACKER_MIGRATE_TMP (a scratch directory) and TRACKER_OLD_SHORT_IDS (the JSON file to write), all ABSOLUTE')
  16. }
  17. // hl:fs readFile stops at 10 MiB (lib/export.hl): Show.jsonl (12.4 MB) is cut into chunks first, like migrate.hl does
  18. shows = 0
  19. found = {}
  20. count = 0
  21. for (l of bigLinesOf(oldDir + '/Show.jsonl', tmpDir + '/show', 5000)) {
  22. d = JSON.parse(l)
  23. shows = shows + 1
  24. if (d.id != null && hlTypeName(d.id) == 'String' && d.id != '') {
  25. found[oidOf(&d._id)] = d.id
  26. count = count + 1
  27. }
  28. }
  29. writeFile(outFile, JSON.stringify(found), 420)
  30. print('shows=' + shows + ' withShortId=' + count + ' → ' + outFile)

Branches

Latest commits

  • 2f986ca3Log: RT50 passmre
  • 1c4715a4RT50 mission: day50 repro retestmre
  • 57d1c0dcLog: day50 retest requestmre
  • 60b1f419Log: Anton #336 result, wake checkmre
  • 919a18aalog: scratchmre
  • 6b504440status tidymre
  • 9332bd10log: DP70 livemre
  • be11daa0DP70 brief fixmre
  • 886a7028DP70 brief, HM67 mergedmre
  • b41cdd6dMerge hm67-searchids: packed search IDsmre
  • 385904eaReport HM67 matched heap measurements and gate proofmre
  • e5c9b659Pack retained search IDs into UTF-8 bytesmre
  • 62a5f6c7HM67 brief, HM66 mergedmre
  • b32b8440Merge hm66-catalogindex: packed catalog indexmre
  • 2db0f7adReport HM66 heap measurements and validationmre
  • 6ce15623Pack catalog lists and membership maps in UTF-8 bytesmre
  • 71134e21HM66 briefmre
  • ed4cbab2status timemre
  • e982c26dlog: HM65 mergedmre
  • 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre