-
Notifications
You must be signed in to change notification settings - Fork 48
make HttpArchive retry configurable #628
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #628 +/- ##
==========================================
+ Coverage 88.77% 88.90% +0.12%
==========================================
Files 49 49
Lines 15864 15867 +3
==========================================
+ Hits 14083 14106 +23
+ Misses 1781 1761 -20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
36320b7 to
171ce70
Compare
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.
Thanks. Just some minor comments...
There seems to be an issue with the test execution on Python 3.12. Maybe one of the new test hangs sporadically?
(BTW, improving on the commit message style would be nice. Just take an inspiration on the existing commits. Usually, the commit message should give a rationale why the change is made. Basically a message to our future selves to understand why things had to be changed. 😉 )
pym/bob/archive.py
Outdated
| if info["path"]: | ||
| entries.append(info["path"].removeprefix(path + "/")) | ||
| prefix = path + "/" | ||
| if sys.version_info >= (3, 9): |
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.
Could you move this to the utils module as a function and call that from here? We usually try to hide such version compatibility things there...
| spec["download"] = "cp {}/$BOB_REMOTE_ARTIFACT $BOB_LOCAL_ARTIFACT".format(self.repo.name) | ||
| spec["upload"] = "mkdir -p {P}/${{BOB_REMOTE_ARTIFACT%/*}} && cp $BOB_LOCAL_ARTIFACT {P}/$BOB_REMOTE_ARTIFACT".format(P=self.repo.name) | ||
|
|
||
| class TestHttpArchiveRetries(Base, TestCase): |
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.
Minor nit: to keep things better reviewable, the tests should be a separate commit. I OK merging it this way but something for keep in mind for the future...
| self.dummyFileName = self.__createArtifact(DOWNLOAD_ARITFACT) | ||
| self.__createArtifact(WRONG_VERSION_ARTIFACT, "0") | ||
| self.__createBuildId(DOWNLOAD_ARITFACT) | ||
| super().setUp() |
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.
I guess you can remove the method if you just call the base class method. Same for tearDown below...
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.
There is more code following here. I agree with the tearDown()
pym/bob/archive.py
Outdated
| def _retry(self, request): | ||
| (ok, result) = self.__retry(request) | ||
| if ok: | ||
| return result | ||
| else: | ||
| raise result | ||
|
|
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.
Why not just modify __retry accordingly? AFAICS, all call sites rely on throwing in case of an error.
Also, please separate the cleanup (getting rid of all the identical if/else constructs) from the actual change. Those are two independent changes.
pym/bob/archive.py
Outdated
| raise result | ||
| return self._retry(lambda: self._webdav.upload(path, tmp, overwrite)) | ||
|
|
||
| def __listdir(self, path): |
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.
Why add a new method? There is only one caller, isn't it. Same for __delete and __stat...
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.
That's a good question. I don't remember my thoughts :>
python 3.8 and older do not have removeprefix() for strings
some backends might be quite unreliable, so a single retry is not sufficient making the retries configurable can mitigate this issue
gets rid of the ugly if else construct all errors are propagated by exceptions anyways
the archive cmd relies on those functions. they can also fail with an unreliable server. applying the retry mechanism here might mitigate those issues
unknown name sounds a lil weird
b723c8f to
2166daa
Compare
Im confused by python 3.12. The tests that I touched both completed... |
It looks like the blackbox test "setup-scripts" did not even start and the coverage is missing. I do not know why. I tested it with pyenv and 3.12.9. The tests just worked. |
|
Strange. Not sure what changed. Seems like I'll have to investigate this. Anyway, that should not prevent us from merging the PR. Thanks. |
No description provided.