Preserve scenario initialization errors during cleanup - #249
Open
tandede wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request information
Description
Problem analysis
single_town06_carlaandsingle_2lanefree_carlaalways enter theirfinallyblocks, including when CAV-world, model, or simulator initialization fails. Several cleanup variables were only assigned after those initialization steps succeeded.In the reported
--apply_mlpath, the original model-loading or network exception was therefore replaced by anUnboundLocalErrorwhen cleanup first referencedeval_manager. The same control flow could also reference an unavailable scenario manager or vehicle list. This hid the actionable failure and made the scenario appear to fail in cleanup instead of at its real initialization boundary.Implementation
Both scenario entry points now establish their cleanup state before entering the scenario:
None;start_recorder()succeeds;The normal successful path is unchanged. The guards only affect partial initialization, and any original exception continues propagating after the resources created before that point are released.
Regression coverage
The new simulator-independent regression stubs the CARLA boundary and exercises the real
run_scenario()functions:On current
main, the first regression reproducesUnboundLocalErrorin both scenario modules. With this change, both original initialization errors are preserved and the partial-resource cleanup assertions pass.Validation
python -m pytest -q test/test_scenario_cleanup.py—2 passed, 2 subtests passedpycodestyleon all three changed filespython -m compileall -qon all three changed filesgit diff --check