Skip to content

Solutions: scientific implementation

1. One fit, four outputs

The selected configuration is correlators/inis/input_0.ini; it is the first file encountered for this output identity. input_6.ini describes the same fit. The log is logs/correlator_tmin10-tmax22_model1exp.log.

The output pattern is ../data/energy_fits/d{momentum}_energy_tmin10-tmax22_model1exp.jack, with momentum equal to 000, 001, 011 and 111. One invocation of the numerical program processes all four momentum channels, so one rule invocation must own all four outputs.

2. Missing output

The missing file makes its fit_correlator job necessary. That job regenerates its four outputs. Selection and dispersion must then run downstream, followed by the all target: four jobs including all. The other 16 distinct fits stay complete.

On a second unchanged run there is nothing to do. We check regeneration and dependency propagation. Moving a file outside the candidate directory also avoids accidentally introducing an extra selection input.

3. Marker-based design

  1. Because the separate Bash process does not stop when Python fails, it still runs touch fit.done. That succeeds, so the wrapper exits with status 0, the status of its last command. Snakemake sees a successful command and the declared output.
  2. If the marker remains, Snakemake cannot see the missing energy file: it is not declared as an output or as a dependency of the later rule. The work can therefore appear complete.
  3. Declare the actual dependencies and ensure that a Python failure reaches Snakemake.

Declare the raw HDF5 file, INI and analysis script as inputs to the fit rule, and all four actual energy files as outputs. Declare all candidate energies as selection inputs. Call Python directly in shell so Snakemake receives its exit status. If you keep the wrapper, enable set -e before the Python call or explicitly return its failure; also declare the wrapper as a rule input. The supplied teaching Snakefile demonstrates the direct call and actual output declarations.

Continue to cluster execution.