Skip to content

Run-2 publishing: per-pixel HATS build, write-once VOSpace upload, partition list from the listing - #992

Open
cailmdaley wants to merge 12 commits into
feat/run2-planningfrom
feat/run2-publishing
Open

cailmdaley wants to merge 12 commits into
feat/run2-planningfrom
feat/run2-publishing

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Run-2 publishing (#987): each cluster builds its order-5 HATS pixels from finished tiles, uploads each file once to VOSpace, and rebuilds the partition list from the VOSpace listing.
This PR is stacked on #991 (planning), whose pixel_tiles.csv, pixel_exposures.csv and claims.yaml it reads; review #991 first, or read this diff against feat/run2-planning.

What changes

  • Source gate (publication_sources.py, pixel_completeness).
    A pixel builds only when every source on its list has its final success manifest or is named in <run_dir>/abandoned.txt.
    An abandoned source contributes no rows, even if a manifest exists.
    A failed source that is not abandoned blocks the pixel, and the builder names it: the run index records no terminal states and a timed-out job leaves no verdict, so a transient failure must never become a permanent gap in a file that is written once.
  • Pixel builder (build_hats_pixel.py, decision row_partitioning, added here).
    Each row goes to the order-5 pixel of its own position (_healpix_29 >> 48), never its tile's; tile overlaps are kept, as in run 1.
    Galaxies and PSF-validation stars are written as HATS Parquet; a star row of an exposure outside the pixel's exposure list is an error.
    npoint, ntaken, nexp and nflagged are written as one HEALSparse file per pixel.
    Every file records the ShapePipe commit and the path and SHA-256 of each UNIONS mask file in its metadata; the masks are read, never copied.
  • Upload (publish_vos.py).
    An existing destination is refused; the upload goes to a temporary node, is checked for size and MD5, and only then moved into place.
  • Partition list (index_vos.py).
    partition_info.csv is rebuilt only from the VOSpace listing, so it never names a missing file; it is the only file that is ever rewritten.
  • publish_pixel.py chains build, upload and reindex for a pixel the cluster owns in claims.yaml, and refuses any other.
    workflow/README.md shows how a collaborator reads the catalogue with lsdb and a CADC proxy certificate.
  • hats is added to pyproject.toml and uv.lock.

Rows go to the pixel of their own position

On the four-pixel prototype patch, 18.6% of the 1.94M rows from the 75 contributing tiles lie outside the pixel that contains their tile's centre.
Assigning whole tiles by centre would put those rows in the wrong pixel, and a cone search would silently miss them.

partition

Checks

Contract Test Injection that fails it
pixel-rows-exact a pixel built from tiles straddling a boundary holds exactly their in-pixel rows, each once drop a tile from the list
code-sha-in-file commit and every mask path and checksum read back from Parquet and HEALSparse omit the commit
write-once a second upload of the same pixel is refused; an MD5 mismatch never exposes the file remove the existence checks
partition-list-from-listing a listing with a partial upload never yields a partition for it derive the list from local files

The stacked branch passes 169 tests, with 1 skipped: tests/unit/test_decisions.py, the run-2 planning and publication tests, the star-catalogue tests and tests/workflow, all run inside the develop image with hats 0.11.1. astra-tools validate passes.
The VOSpace client is a fake in these tests; the real path passed an acceptance run on one Nibi and one Fir pixel across the seam (comment), which also produced the CADC property-lag fix 345bda2.

Not yet done

  • Temporary nodes. A failed upload leaves its .part node beside the final file, which breaks strict HATS validation of a downloaded copy; staging temporary nodes outside the catalogue tree would prevent it.
  • Mask list. publish_pixel.py takes the mask files as repeated --mask arguments; reading them from the run config would stop an operator recording a subset.
  • Obsolete (all outside this repository, in the run-1 operations tree): the merged latest/ builder (sp_latest.py, rebuild_latest.sh), the VOSpace snapshot scripts (publish_vos.sh, vos_snapshot.py, finish_run1_snap1.sh, Fir's upload_from_fir.sh), and the batch feeder and Fir import scripts, which ownership replaces.
    In ShapePipe, merge_final_cat.py, merge_star_cat.py and merge_exposure_maps.py stay for now: existing campaigns and the image simulations still use the merged outputs.

— Claude (Opus 5.5) on behalf of Cail

Closes #987.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JK7o9DiztKSbcdLjwXNWmh

cailmdaley and others added 12 commits October 29, 2026 22:25
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
Co-Authored-By: GPT (via confer) <noreply@openai.com>
@cailmdaley

Copy link
Copy Markdown
Contributor Author

Acceptance run: the stacked branch publishes and reads back correctly from both clusters, after one uploader fix, now on this branch as 345bda2.

I processed one Nibi-owned order-5 pixel (2922) and the Fir-owned pixel next to it (3008) from scratch at bb5a727, using the normal launcher on each cluster. The two pixels share an edge on the Nibi/Fir seam. Each cluster published its own pixel with publish_pixel.py to the scratch root vos:cfis/weak_lensing/ShapePipe/v2.x/run2-accept/; v2.0/ is untouched.

Nibi 2922 Fir 3008
Closure tiles / exposures processed 29 / 47 28 / 44
Tiles run on both clusters 8 8
Galaxies / stars published 527,618 / 7,416 415,500 / 5,427
Allocated core-h (scientific job) 284.1 (9.8 / tile) 195.9 (7.0 / tile)
Build (galaxies + stars + 4 maps), wall 102 s 87 s
Upload + verify + move, wall 408 s (10 files, incl. the catalogue metadata written once) 231 s (6 files)

What passed against real CADC:

  • Size and MD5. After each file moved from its temporary node to its final name, its size and MD5 on CADC matched the local file. All 18 published files also match what I downloaded back.
  • Write-once. Publishing a pixel a second time is refused, and a listing of the remote tree before and after is identical. Each cluster refuses to publish the other's pixel.
  • Partition list. After the first publish, partition_info.csv lists only 2922; after the second, exactly 2922 and 3008. Both clusters rebuilt it at the same time (starts 6 ms apart), and both results list both pixels.
  • lsdb over authenticated HTTPS. The catalogue opened after the first pixel and again after the second. Row counts equal the local builds. A 1° cone on the seam returns rows from both pixels, and no galaxy or star appears in both.
  • HATS validation. Both catalogues pass strict validation, once the leftover .part files below are removed.
  • Maps and provenance. All eight HEALSparse maps read back, with every valid pixel inside its order-5 parent. The ShapePipe commit and the 11 mask paths and SHA-256 hashes read back from the Parquet files and the maps.

Fix found. CADC updates a node's size and MD5 a few seconds after the transfer finishes, so the first real uploads failed verification even though the bytes were correct. 345bda2 re-reads the node for up to 60 s and still fails if they never match. Its unit tests pass (17), and it worked on both clusters.

Not changed here, open for review:

  • Leftover .part files. Before the fix, the failed upload left a temporary node next to the final file. Reindex and lsdb ignore it, but a recursive download then sees a duplicate pixel path and fails strict HATS validation. I removed both leftovers after checking them against the final files. The clean fix is to stage temporary nodes outside the catalogue tree, for example <root>/.incoming/, so a failed upload never leaves anything inside a catalogue.
  • Exposure list. The builder checks every star and map position of an exposure against the exposure list before narrowing to the pixel, so it needs the survey-wide pixel_exposures.csv; a list with only the pixel's own exposures fails. Production uses the survey-wide list anyway, and the check costs about 2.7 s per build, so I'd keep it.

Reports: on Nibi, /scratch/cdaley/run2-hats/accept/REPORT.md and FIR_REPORT.md.

— Claude (Opus 5.5) on behalf of Cail

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant