Repository navigation
Report failed folder uploads and keep the description file - #222
Open
chrisdebian wants to merge 2 commits into
Open
chrisdebian wants to merge 2 commits into
chrisdebian wants to merge 2 commits into
Conversation
A failed folder upload was silent: upload() returned the failure in its result, nothing read it, the command exited 0, and the description file was removed in `finally`, so the upload couldn't simply be run again. Now the failure is logged, the upload command exits non-zero, and the description file is only removed after a successful upload. Refused descriptions from upload_desc() also count as a failure. upload() still returns its result dict, because MapSyncer reads it.
upload.py imports it at module level, and CI doesn't install it. tests.yml already says it's stubbed in conftest.py, but it wasn't, because no test imported upload.py until now.
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.
As you asked on #220. A failed folder upload was silent:
upload()returned the failure in its result, nothing read it, the command exited 0, and the description file was removed infinally.What changes:
uploadcommand now exits with an error when the upload fails.mapilio_image_description.jsonis removed only after a successful upload. It's also kept if the upload is interrupted with Ctrl+C.upload_desc()gets an HTTP error, that now counts as a failure. Before, it returned nothing and led to a confusingTypeError. If any sequence is refused, the whole upload is reported as failed, so the file is kept.upload()still returns its result dictionary, because MapSyncer readsresult['Success']. The new exception is raised in theuploadcommand instead, so MapSyncer isn't affected.Two things to check, please:
video_uploadruns the upload command once per video, so it now stops at the first failed video, where before it carried on to the next. I think stopping is right, because each failure now needs attention, but it's a change in behaviour and your call.Testing:
pytestgives 126 passed locally, including 5 new tests intests/test_upload_failure.py. With the code change removed, 4 of the new tests fail. The tests don't import the fulluploadcommand path, because the test setup stubs some of its packages, so I also ran that path once by hand with a forced failure. It logged the error, exited with code 2 and kept the file. I haven't tried it against the real server.This was written with Claude Code, and I've reviewed it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ue2Xf3pagU5DPwLibqEjFy