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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
combats uploader race condition #4
combats uploader race condition #4
Changes from 3 commits
e8ee20f
f8ed237
46ec7c7
f588362
d81fd8e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use logging.exception when you want to print the stack trace for the exception. Since there is no exception at this point, no need to do this. Additionally we will print the raised exception on line 44 so no need to print it twice, just the raise is good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robkooper
I'm trying to parse this out.
I think you're saying that when the checks for the file are exhausted, it's not appropriate to call "logging.exception". But are you saying to leave the "raise ValueError"?
I just want to make sure that if the uploader fails because the file it's been told to upload doesn't exist, then what file it's looking for is explicitly stated and that "does not exist", so that the user knows it's not a network problem or a queue problem or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a point of clarity: The
logging.exception()
is being called in thetry:
block that started on line 30. At line 44, no exception as been raised thatlogging.exception()
can use in its massaging.As a loose rule,
logging.exception()
should only be called inexcept:
blocks.The
except:
block is where the program skips to when an exception is raised and thus there is a traceback availbile thatlogging.exception()
can "read" and populate the logging message with. Notice this is what is happening between line 51 and 56There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robkooper I used the github interface to apply the patch.
Once I got the file back, I don't think it was right. So I spliced the two trees together the way I think you were thinking, which I agree with; it's much more compact. And I removed the logging.exception but left the raise ValueError.
Let me know if that matches what you were thinking. If you think this looks Ok, we should probably exercise the uploader both normally, without the race condition, and then artificially trip it so that it definitely fires, so to make sure it flows correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asaxton
Ah, thanks, that helps a lot.
Unfortunately I uploaded a new commit just as you posted that comment. Could you glance at the new commit? The patch tool in github kind of mangled the test loops and the new commit cleans them up.
Also I think I've fixed my original misplaced "except" statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks correct to me.