# Inspect Stored Failure Logs You can load all Resultbag results and select entries with `entry.failure is not None`. There is no `result.failures` attribute. This example uses the same mixed batch as the [batch failure tutorial](../core/solve/batch_failure_logs.md). Use an installed package, a configured JCMsuite runtime, and a solver license: ```bash python demos/documentation_tutorials/failure_logs/resultbag.py ``` ```{literalinclude} ../../../demos/documentation_tutorials/failure_logs/resultbag.py :language: python ``` The script creates a fresh trusted bag, runs two successful entries and one deliberate failure, then prints the stored failure and its attempt records. The temporary bag is removed when the script exits. To inspect your own bag, open its trusted file and start at `stored = bag.get_results()`. ## Retrieval Caveats - `get_results()` returns a standard result shape, not always a batch. One successful entry returns a `SolveResult`. Empty selections raise `InvalidConfigurationError`. This example stores a mixed batch, so retrieval returns a batch that you can iterate over. - The default selection includes unsuffixed entries. Pass the matching `jcmt_pattern` to retrieve entries stored under that pattern. Pass the same pattern to management log methods. - Stored successful results take precedence over attempt-only records with the same identity. An earlier failed attempt followed by success is not a currently failed result. - Final attempt-only entries are promoted to failures. Their failure message represents the final stored payload, and their `entry.log` is not populated. Use `bag.management.get_attempt_logs(entry.keys)` for detailed records. Records can contain an `execution_log` mapping with `stdout`, `stderr`, and `return_code`, in addition to exception and attempt information. - Errors before execution attempts begin need not have stored attempt records. Resultbag retrieval is not an inventory of every error ever raised. - Retrieval indices describe the selected stored entries, not necessarily the original batch positions. - Only open Resultbag files you trust. Resultbag loading uses Python pickle. ## Project Files
project.jcmp ```{literalinclude} ../../../demos/documentation_tutorials/failure_logs/project.jcmp :language: jcm ```
materials.jcmt ```{literalinclude} ../../../demos/documentation_tutorials/failure_logs/materials.jcmt :language: jcm ```
layout.jcm ```{literalinclude} ../../../demos/documentation_tutorials/failure_logs/layout.jcm :language: jcm ```
sources.jcm ```{literalinclude} ../../../demos/documentation_tutorials/failure_logs/sources.jcm :language: jcm ```