Skip to main content
Contents

Reference


On this page

Reference

API Reference

class asimov_pesummary.pesummary.PESummary(production, category=None)[source]

Bases: Pipeline

A postprocessing pipeline add-in using PESummary.

A production using this pipeline may be either a regular analysis (post-processing a single upstream production’s samples) or an asimov SubjectAnalysis (combining several productions’ samples into one set of summary pages). SubjectAnalysis productions marked refreshable: true are automatically resubmitted by asimov’s monitor loop whenever their resolved source analyses change; when that happens here, one of three things is submitted depending on how the resolved set changed since the last run:

  • analyses added only: the newly-added analyses are passed to summarypages, using its own --add_to_existing/ --existing_webdir flags to append them to the already-published pages rather than recombining everything from scratch;

  • analyses removed only (nothing added): summarypages has no way to retract a label from an existing page in place, so instead summarymodify --remove_label strips the removed analyses out of the existing metafile directly, and summarypages is re-run against that trimmed metafile to regenerate the pages – cheap, since none of the surviving analyses’ posteriors need recomputing;

  • anything else (a mix of additions and removals, the first run, or a previous page that’s gone missing on disk): a full rebuild is triggered, recombining every currently-resolved analysis from scratch.

rename_analysis() exposes a related summarymodify operation (renaming a stored label) directly, for callers to invoke explicitly – it isn’t wired into the automatic refresh above, since a before/after diff of resolved dependency names alone can’t distinguish “renamed” from “removed one, added an unrelated one”.

property config_template

A minimal bundled config template.

Asimov’s generic manage build step calls production.make_config() to render a production’s own .ini from a template, whenever one doesn’t already exist in the event repository (see repository.find_prods()). Without this, asimov falls back to looking for a pesummary.ini template inside its own package, which doesn’t exist there any more – PESummary moved out of asimov core into this plugin – so make_config() raises TemplateNotFound (see FakeCBCPipeline.config_template in testing.py, which hit and documented this same gap first). The rendered file is what summarypages --config receives (see _submit_single_analysis/_submit_subject_analysis); PESummary’s own actual behaviour is controlled by the explicit CLI flags built from self.meta elsewhere in this class, so this only needs to be a valid, renderable ini for provenance/display purposes.

results()[source]

Fetch the results file from this post-processing step.

A dictionary of results will be returned with the description of each results file as the key. These may be nested if it makes sense for the output, for example skymaps.

For example:

{'metafile': '/home/asimov/working/samples/metafile.hd5',
 'skymaps': {'H1': '/another/file/path', ...}
}
Returns:
dict

A dictionary of the results.

collect_assets()[source]

Advertise this pipeline’s combined metafile, in case a further downstream step ever needs to consume it.

detect_completion()[source]

Detect that this production’s own summarypages run has finished.

The base Pipeline.detect_completion() is an unconditional no-op (always falsy). Once this production’s HTCondor job has exited and asimov’s monitor loop is no longer tracking a job id for it, asimov monitor’s no-job-id branch (_handle_no_condor_job in asimov’s monitor_states.py) relies entirely on this method to decide whether to mark the production finished; without an override here it always finds this falsy and repeatedly logs “is stuck; attempting a rescue” – forever, since the base resurrect() is an equally unconditional no-op that never raises, so the production never progresses no matter how long or how often it’s polled, even once a genuine, correctly labelled posterior_samples.h5 already exists on disk.

Delegates to detect_completion_processing(), which already implements the right check for this pipeline’s own output: that posterior_samples.h5 exists, is readable, and (for a SubjectAnalysis) contains every expected analysis’s label as a top-level group.

That check alone is unsound while a removal or rename (see _submit_subject_analysis_removal/rename_analysis) is in-flight: it only checks that expected labels are present, never that anything unexpected is absent, so an untouched metafile from before a removal already satisfies “surviving labels present” – it would look complete before the summarymodify/summarypages chain has even run, let alone finished. So when a chained operation is pending (tracked via the pesummary_pending_chain_labels meta key), this first requires the chain’s own completion marker to exist – proof every step of that script actually ran, not just the first – before finalising resolved_dependencies to what the chain was renaming/removing towards and falling through to the normal check above.

build_dag(user=None, dryrun=False)[source]

No-op: PESummary has no separate build step. All of the work happens in submit_dag, but asimov’s generic manage build submit CLI unconditionally calls build_dag on every pipeline before submit_dag, so this must exist.

submit_dag(dryrun=False)[source]

Run PESummary on the results of this job.

rename_analysis(old_label, new_label, dryrun=False)[source]

Rename a stored analysis in this subject analysis’s published metafile, without re-running or recombining anything.

This is not wired into the automatic refresh cycle: given only a before/after diff of resolved dependency names, asimov can’t tell “an analysis was renamed” apart from “one was removed and an unrelated one was added”. Call this directly – e.g. from a one-off script – when a production has been renamed in the ledger and its already-computed results should carry over under the new name rather than triggering a full re-run.

Parameters:
old_labelstr

The analysis’s current stored label.

new_labelstr

The label to rename it to.

dryrunbool, optional

If True, print the commands that would be run rather than submitting them.