Skip to content

Bring the survey-wide publisher (latest catalogue and maps) into ShapePipe, with a validated inventory cache #982

Open

Description

@cailmdaley

Superseded by #987 if run 2 publishes HATS pixels. That design retires latest/ and this builder: a per-pixel reducer and one indexer replace the survey-wide rebuild, so there is no whole-survey inventory to cache. This issue covers only the case where latest/ stays.

The survey-wide catalogue and maps are built by a publisher that lives outside ShapePipe, and every refresh re-reads the whole survey.

ShapePipe's workflow merges one campaign: workflow/rules/{tile,exposure}.smk write final_cat_<run>.hdf5, full_starcat_<run>.hdf5 and the per-campaign maps. On Nibi, the cross-campaign products are built by a 1,450-line sp_latest.py deployed in the production products tree, together with its partitioned map engine and regression tests. That deployment is the only copy of the code. Products: final_cat_latest.hdf5, full_starcat_latest.hdf5, survey maps. workflow/scripts/hdf5_reconcile.py already does per-batch reconciliation upstream, so the per-campaign half exists here; the survey-wide half does not.

Cost. Its inventory opens every tile's HDF5 file and reads every column length on every refresh. A ~2,100-tile top-up spent about 7 hours, 50 GB of reads and 22 CPU-minutes on that inventory alone. A timed-out run spent about 9 hours there. Production therefore runs the refresh under a hand-set 47:59 wall-time budget.

Proposal.

  1. Port the publisher into workflow/scripts/ with publication rules or targets and its tests. Products and their layout stay as they are: per-tile and per-exposure products remain the reusable inputs, the appended survey catalogue is still produced, and maps keep their bounded-memory partitions and checkpoints.

  2. Cache the validated inventory. Each tile's row count and schema check are keyed by:

    • canonical path, size, nanosecond mtime, ctime and inode;
    • the builder's code hash, the merge-column set, and the h5py/HDF5 versions.

    A hit stats the file and does not open it. A miss runs the full validation. Device IDs are left out of the key because NFS clients disagree on them. A prototype of this cache, with 48 tests, is staged for the Nibi deployment and can be the starting point.

Acceptance.

  • On an unchanged source set, a refresh opens no source HDF5 file.
  • A changed file, schema or builder invalidates exactly the affected entries.
  • Cached and uncached plans produce identical products.
  • No-op time, incremental wall time and peak memory are measured before anyone lowers the wall-time budget.

Related: #971 (mtime alone is not a safe freshness signal on Lustre, hence the strong key), #965 (input staging, the other half of a campaign's lifecycle that sits outside the repository).

Found by the Nibi production audit, 28 Oct.


Claude (Opus 5.5) on behalf of Cail.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions