Skip to content

Conversation

@MarcKe
Copy link
Contributor

@MarcKe MarcKe commented Mar 26, 2025

No description provided.

@MarcKe MarcKe changed the title Mk archive retry make HttpArchive retry configurable Mar 26, 2025
@codecov
Copy link

codecov bot commented Mar 26, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88.90%. Comparing base (26caae1) to head (2166daa).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
pym/bob/archive.py 94.11% 1 Missing ⚠️
pym/bob/utils.py 83.33% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MarcKe MarcKe force-pushed the mk_archive_retry branch 3 times, most recently from 36320b7 to 171ce70 Compare March 26, 2025 13:01
@MarcKe MarcKe marked this pull request as ready for review March 26, 2025 13:13
Copy link
Member

@jkloetzke jkloetzke left a 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. 😉 )

if info["path"]:
entries.append(info["path"].removeprefix(path + "/"))
prefix = path + "/"
if sys.version_info >= (3, 9):
Copy link
Member

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):
Copy link
Member

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()
Copy link
Member

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...

Copy link
Contributor Author

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()

Comment on lines 888 to 894
def _retry(self, request):
(ok, result) = self.__retry(request)
if ok:
return result
else:
raise result

Copy link
Member

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.

raise result
return self._retry(lambda: self._webdav.upload(path, tmp, overwrite))

def __listdir(self, path):
Copy link
Member

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...

Copy link
Contributor Author

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 :>

MarcKe added 6 commits March 28, 2025 09:29
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
@MarcKe MarcKe force-pushed the mk_archive_retry branch from b723c8f to 2166daa Compare March 28, 2025 09:13
@MarcKe
Copy link
Contributor Author

MarcKe commented Mar 28, 2025

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. 😉 )

Im confused by python 3.12. The tests that I touched both completed...

@MarcKe
Copy link
Contributor Author

MarcKe commented Mar 28, 2025

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. 😉 )

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.

@jkloetzke
Copy link
Member

Strange. Not sure what changed. Seems like I'll have to investigate this. Anyway, that should not prevent us from merging the PR.

Thanks.

@jkloetzke jkloetzke merged commit d4b9522 into BobBuildTool:master Mar 28, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants