Metadata-Version: 2.4
Name: daylily-ephemeral-cluster
Version: 22.0.16
Summary: Infrastructure-as-code for ephemeral AWS ParallelCluster environments for bioinformatics
Author-email: Daylily Informatics <daylily@daylilyinformatics.com>
License-Expression: GPL-3.0-only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3>=1.26.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: ruamel.yaml>=0.18.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: typer<1,>=0.12
Requires-Dist: cli-core-yo==2.2.0
Requires-Dist: rich<15.0.0,>=14.0.0
Requires-Dist: setuptools<81
Requires-Dist: setuptools-scm>=8
Requires-Dist: requests>=2.31.0
Requires-Dist: tabulate>=0.8.10
Requires-Dist: python-dateutil>=2.8.2
Requires-Dist: aws-parallelcluster==3.15.0
Requires-Dist: typeguard~=2.13.3
Requires-Dist: pytest>=7.4.0
Requires-Dist: pytest-cov>=4.1.0
Requires-Dist: moto>=4.2.0
Requires-Dist: black>=23.0.0
Requires-Dist: ruff>=0.1.0
Requires-Dist: mypy>=1.5.0
Requires-Dist: boto3-stubs[ec2,s3]>=1.28.0
Requires-Dist: ipython>=8.0.0
Requires-Dist: prompt-toolkit<3.0.52,>=3.0.41
Requires-Dist: yamllint>=1.35.0
Provides-Extra: reports
Requires-Dist: reportlab<5,>=4.0; extra == "reports"
Dynamic: license-file

# Daylily Ephemeral Cluster

DYEC manages AWS ParallelCluster creation, headnode setup, sequencing mounts,
pinned DayOA launches, monitoring, and result export. It consumes explicit
configuration, manifests, source pins and file receipts. It does not require an
identity service. DayOA owns its scientific rules and the `dy-r` workflow wrapper.

Start with the [Agent and Operator CLI Guide](docs/agent_cli_guide.md). It is the
canonical walkthrough for both humans and agents. [AGENTS.md](AGENTS.md) contains
the repository's operational constraints and approval rules.

Use the [DYEC core operations runbook](docs/runbook_dyec_core_stuff.md) for the
current step-by-step Intel and native DRAGEN cluster creation, declared input
preparation, catalog render/dry/same-root live continuation and scoped full-root
export/cleanup. Its original `pclu-2100` campaign remains preserved below the
current procedure at its actual DYEC 21.0.0 / DayOA 19.0.0 execution versions.

The [alternative/native command catalog](docs/native_command_examples.md) adds
the verified Sarek Nextflow minimal test and Simple Snakemake threads example.
Use `dyec catalog alternatives --dyec-version <installed-release>` to inspect
their pinned recipes and native exit-code evidence. The runbook includes the
[DYEC discovery, connection, launch and monitoring steps](docs/runbook_dyec_core_stuff.md#run-an-alternative-command-through-dyec)
for both recipes.

## Install an exact release

This guide describes DYEC **22.0.0**, coordinated with DayOA **20.0.0**.
Read the [breaking migration notes](docs/releases/22.0.0.md) before preparing a
new capsule. Prior production acceptance retains its actual producing versions;
source publication is separate from deployment and new workflow acceptance.
Catalog format7 retains eleven production commands, existing test/development
rows, native alternative recipes and the frozen R49 product-matrix registry.

A selected source tag is distinct from the catalog's historical validation tag;
inspect each command's evidence before treating it as validated on that source.

```bash
git clone --branch 22.0.0 git@github.com:lsmc-bio/daylily-ephemeral-cluster.git
cd daylily-ephemeral-cluster
source ./activate
dyec --json version
dyec --json catalog list --dyec-version 22.0.0

dyec agent guidance
```

`activate` creates or activates the DAY-EC environment. Release-sensitive
catalog and headnode operations require an exact numeric release; a development
checkout fails that gate. Source and packaged catalog snapshots must agree.
AWS permissions, registered templates, explicit subnets, existing private Git
credentials and source buckets are separate prerequisites. Do not put tokens in
commands, manifests, logs or repository files.

## Operate through the CLI

Use the canonical guide for complete arguments and the installed command's
`--help` for its current options. Keep the saved state and all native receipts.

| Operation | Public entry points | Required evidence or boundary |
|---|---|---|
| Preflight and launch a cluster | `dyec preflight`, `dyec create` | Explicit account/profile, AZ, config, budgets and source bindings. Create owns rendering, pricing, provider creation, headnode configuration and accounting. |
| Verify readiness and saved state | `dyec cluster describe`, `dyec state show` | Provider completion alone is insufficient; retain the exact state file and readiness/accounting result. |
| Discover and render a catalog job | `dyec catalog list`, `show`, `render` | Inspect source pin, required manifests, runtime config and validation history. Rendering submits no work. |
| Launch and continue DayOA | `dyec catalog launch`, `dyec workflow launch --continue-from-dry-attempt ...` | Successful dry and live commands use the same capsule, source, inputs and config; remove only `-n`. |
| Monitor clusters and jobs | `dyec cluster monitor`, `dyec headnode jobs` | Queue state is an observation, not a workflow completion receipt. |
| Monitor one controller | `dyec workflow status`, `dyec workflow logs`, `dyec analysis status full` | Read the exact native attempt and terminal exit status. A status-query timeout is UNKNOWN. |
| Stop a controller | `dyec workflow stop` | Exact root/session and current caller lock ownership; Ctrl-C waits for the bound native terminal attempt. Timeout fails and preserves the session. Force requires explicit `--force-kill-session`. |
| Cancel exact Slurm jobs | Owning-shell `dyec analysis guard --operation kill -- scancel <job-id>` | Verify job IDs, owner and working roots first. Legacy headnode job-action endpoints do not enforce capsule lock ownership. |
| Export DayOA results | `dyec analysis visit --mode export`, `dyec exports preflight`, `dyec export` | Complete successful DRA receipt plus S3 evidence; accepted tasks are not completed exports. |
| Delete a cluster | `dyec delete --dry-run`, then approved `dyec delete` | Inventory every root/resource, verify preservation and idle workloads, own required locks, and obtain exact destructive-action authorization. The delete command does not enforce every operator gate. |
| Manage explicit run mounts | `dyec mounts create`, `verify` | Exact non-overlapping source binding; large imports can take over 40 minutes. |
| Release input cache | `dyec mounts release-cache PATH` | Explicitly evict after the last consumer. Names remain; later reads hydrate content. |

`create --heartbeat on|off` defaults to `on`; choose `off` when recurring AWS
heartbeat automation is outside the approved scope. The independent
`--fsx-node-health-mode` defaults to `observe`; choose `disabled` when its
recurring observations are outside scope. These are separate controls.

Controller action `stop`/`restart` mean SIGSTOP/SIGCONT: suspend and resume the
same process. They are distinct from graceful workflow termination. See the
[stop and cancellation guide](docs/agent_cli_guide.md#stop-suspend-and-cancel-are-different-operations).

Catalog rows require explicit `compatible_cluster_types` (`daywgs`, `dragen`,
`sentieon-single`); root creation's `--cluster-type intel` is a template selector.
The DRAGEN development row uses checked default activation, `slurm_rhel`,
`hg38_broad`, `ec2-user` and non-containerized native execution. Intel production
lanes use `slurm` / `ubuntu`. See [current catalog CLI procedure](docs/running_command_catalog_commands_from_cli.md).
The invocation-only `--campaign-jobs`, `--campaign-restart-times`,
`--campaign-print-shell-commands`, and `--campaign-keep-going` options preserve
catalog defaults. Native `-T` is retry count, not threads.

Trust the controlling documented return/success result; do not add redundant
post-success source checks, checksums, HEAD probes or readbacks. Ordinary export
preserves FSx. Explicit integrated export-and-delete of exact new roots retains
its scoped single approval and native gates; see the catalog procedure before
using `--delete-data-in-file-system`. No S3 deletion is supported.

## CPU-only scheduling and sequencing inputs

Slurm placement is deliberately CPU-only. Do not restore memory scheduling or
pass `--mem`, `--mem-per-cpu`, `--mem-per-gpu`, `--mem-per-tres`, or equivalent
memory requests. Select a suitable partition/node shape and CPU count.
Application memory settings and observed RSS remain separate from scheduling.

## Reproduce the HG002 data and capability matrices

Treat the matrix as a set of explicitly identified analysis configurations, not
as a command that fills every blank with a new run. Each configuration needs its
platform, nominal and achieved coverage, read length, caller, reference/profile,
six input manifests, runtime configuration, exact source commit, analysis root
and native attempt ID. Execution status, matched accuracy, S3 preservation and
document publication are separate outcomes. Reticular and unrelated Inflection
drafts are outside this HG002 reference comparison.

The campaign families are Illumina Sentieon linear/pangenome and DRAGEN
linear/pangenome; ONT Solo; Ultima Solo; Ultima+ONT linear; and Illumina+ONT or
Ultima+ONT pangenome. The approved linear grid is Ultima 60/30/15/7× crossed with
ONT 2/5/10/20×. The Illumina Solo campaign uses 15/30/60× and paired read lengths
50/100/150 bp. A document-only proposal must acquire explicit configuration,
source and budget bindings before execution; it is not an already-running job.

Start from the selected numeric DYEC release and inspect the exact campaign
row's catalog pin and current admission state:

```bash
source ./activate
dyec --json version
dyec --json catalog list --dyec-version <exact-dyec-release>
dyec --json catalog show <exact-command-id> --dyec-version <exact-dyec-release>
dyec --json cost-controls status --profile <profile> --region <region> \
  --cluster <cluster> --cluster-budget-name <cluster> \
  --cost-center <approved-cost-center>
```

Use the [catalog render/dry/live procedure](docs/agent_cli_guide.md#5-preferred-path-catalog-render-dry-controller-and-live-controller)
with that row's existing six manifests, runtime config and input/reference
bindings. Review the rendered effective command before launch. Keep the user's
existing concurrency, never below `-j 25` without an explicit request. A passing
dry run submits zero jobs. Continue its exact capsule with only `-n` removed;
do not create a second live root or rerun a completed case to update reporting.

For the Ultima+ONT linear configuration, the retained scientific/reporting
target set is below. Run it only in the row's existing, initialized persistent
headnode shell, with its exact in-clone config and approved source. This is a
dry command; it does not grant budget or launch authority.

```bash
source dyoainit
dy-a slurm hg38_broad
dy-r produce_alignstats produce_mosdepth_nonsecondary_segments \
  produce_na_dedup_cram produce_sentdhuomr_snv_vcf produce_sentdhuomr_sv \
  produce_snv_concordances produce_relatedness produce_multiqc_all \
  results/day/hg38_broad/reports/DAY_final_multiqc.html \
  results/day/hg38_broad/reports/dayoa_evidence_manifest.json \
  -j 25 -T 1 -p -k --configfile config/dyec_runtime_config.yaml \
  --produce-rulegraph false --produce-filegraph false --produce-dag true \
  --rerun-triggers mtime -n
```

Missing Stage2 indexes must be regenerated by the workflow's explicit
`sentdhuomr_stage2_indexes` producer and declared Stage3 dependencies. Do not
manually add sidecars or describe the unrepaired 19.0.54 tag as containing the
later repair. A clean published source carrying both the index contract and
configured-region correction is a prerequisite for new grid admissions.

After native terminal acceptance, collect the task-level capability evidence
from the same initialized analysis checkout:

```bash
bash bin/util/benchmarks/collect_day_benchmark_data.sh hg38_broad
```

The collector produces `results/day/hg38_broad/reports/benchmarks_summary.tsv`.
Bind every value to its native task rows, source hashes, configuration and
measurement cutoff. Keep task wall seconds, observed CPU seconds, declared
thread-hours and estimated task cost separate from whole-workflow elapsed time,
actual allocated vCPU-hours and the provider bill. An absent allocation field
does not become a measured allocation. Read accepted metrics from FSx when an
export has not yet completed; preserve the exact source path and hash.

The document publisher consumes the accepted resolved comparison model plus
per-value provenance to generate the capability matrix and heatmaps. Preserve
strict versus NIST/GIAB-HC profiles, linear versus pangenome, DEL+INS versus
all-SV, historical proxies and coverage definitions. Missing or incompatible
evidence remains an explicit gap. Use the same model, metric keys and scale
definitions for V1/V2. V1 retains its Viridis palette and gray labeled gaps;
intentional V2 presentation differences require separate verification.
Rendering must not launch analysis or export work.

For the reproducible local assembly, use the private, hash-pinned source package
and its `matrix_inputs.json` manifest. From this activated checkout:

```bash
dyec matrix render --manifest /path/to/accepted-source-package/matrix_inputs.json \
  --output-dir /path/to/fresh-matrix-output
```

The manifest binds the baseline model, accepted source snapshots, package member
hashes, exact configuration/AU identities, measurement units and primary
truth/ROI/caller/reference profiles. The command rejects duplicate observations,
sample/profile/hash mismatches and inconsistent pooled precision/recall/F1 counts.
It verifies supplied snapshot and package bytes locally. Original FSx/S3 artifact
hashes inside accepted records remain their prior qualification receipts unless
those original files are also explicitly included in a checked package; rendering
does not re-fetch or independently re-qualify those remote sources.
It uses the retained `generator_core.py` and `spec_summary.py` to produce both
selected-product SVGs and the full-condition SVG/CSV/JSON. New exact conditions
are added to the full view; unlike generic product cells are never filled by
name similarity. `heatmap.html` embeds these generated SVGs, an accessible
per-value source index and offline JSON/CSV downloads, with no sibling-file
dependency or private Library transfer URLs. The original Doc baseline,
accepted evidence cutoff and generation time remain separate. Hash-bound row
annotations can resolve identity/status and expose holds but cannot replace
numeric measurements. Proposal, no-attempt-in-inventory, not-assessed and
incompatible-profile states retain their different meanings. Meanwhile,
`per_value_ingestion_audit.json`, `component_observations.json` and
`render_receipt.json` retain exact values, provenance, accepted/excluded ROI
decisions, source/code hashes, output hashes and counts. The output directory
must be new. This local command performs no workflow, export or publication.

The recovered renderer's original Git commit is not established; its byte-level
origin is recorded in `daylily_ec/matrix_renderer/UPSTREAM.json`. Dataset packages
remain versioned private evidence, not arbitrary source trees scanned at render
time. The October 11–25 global source audit must reconcile additional accepted
configurations, retries and superseding exact results before declaring the matrix
complete. Whole-matrix launch recipes and their source pins are still being
reconciled; this is not authorization for an unattended paid replay. Final
cutover requires all required configurations, accepted source audits, and an
explicit V1/V2 equivalence review. Full-root S3 inventory/integrity and any
destructive cleanup approval remain separate gates.

New clusters present the exact configured sequencing S3 root read-only at
`/fsx/sequencing_run_data/`. Metadata import exposes names; selected reads
hydrate contents. Preserve full relative paths and verify source run completion.
Do not scan or hydrate the entire root merely to inspect it. The
[sequencing input contract](docs/sequencing_input_contract.md) describes startup
bindings, historical/ad-hoc mounts and explicit cache release.

## Native examples and supporting repositories

The native examples have repository-only catalog rows with
`analysis_commands: []`. Use their tagged guides and native engines; DayOA
controller/status/export success must never be fabricated for another engine.

| Example | Private source tag | Run guide |
|---|---|---|
| Sarek minimal Nextflow test | `lsmc-bio/daylily-sarek` `0.7.381` | [Native Sarek guide](https://github.com/lsmc-bio/daylily-sarek/blob/0.7.381/docs/native-lsmc.md) |
| Simple one/eight-CPU Slurm proof | `lsmc-bio/smk-simple-slurm` `0.1.3` | [Native Snakemake guide](https://github.com/lsmc-bio/smk-simple-slurm/blob/0.1.3/docs/native-lsmc.md) |
| Small yeast RNAseq example | `lsmc-bio/rna-seq-star-deseq2` `0.1.17` | [Native RNAseq guide](https://github.com/lsmc-bio/rna-seq-star-deseq2/blob/0.1.17/docs/native-lsmc.md) |

Sarek's selected test runs Nextflow's local executor inside one explicit
CPU-only Slurm allocation. Its standard distributed Slurm profile still emits
memory requests and is unsuitable for this scheduler. The native Snakemake
examples use explicit engine/executor pins and cost-center comments. Local
checks and dry plans do not establish live AWS completion.

Private [reference tooling](https://github.com/lsmc-bio/daylily-omics-references)
and [controls metadata](https://github.com/lsmc-bio/daylily-omics-controls)
retain upstream provenance and licenses. This campaign does not refresh public
S3 buckets or change public defaults or IAM policies.

## Further operational contracts

- [Analysis-root visits, ownership and guards](docs/analysis_root_agent_locking.md)
- [Cluster and cost-center identities](docs/cost_context.md)
- [FSx telemetry and benchmark attribution](docs/fsx_telemetry.md)
- [FSx network inspection and explicit repair](docs/fsx_network_contract.md)
- [Production SeqQC source bindings](docs/seqqc_catalog_run_inputs.md)
- [Historical agent-plan index](docs/reference/agent-history/INDEX.md)

Active dated ledgers remain in `docs/plans/`. Inactive plans and associated
evidence live under `docs/reference/agent-history/`, with byte-preserving path
maps. Archive placement never establishes that an old workflow completed.
