Skip to content
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

minor sync cleanup: typing, logging, and burying file descriptions out of the API #394

Closed
wants to merge 1 commit into from

Conversation

ferringb
Copy link
Contributor

commit 23a9857
Author: Brian Harring ferringb@gmail.com
Date: Tue Jan 10 02:00:23 2023 -0800

fix(sync): Add loggger.debug() of the sync command actually being invoked.

Additionally, since we know the sync subsystem was written before basic sanity
of the frontend, and we know that it invokes processes that write to stdout/stderr,
force a flush of those handles to ensure that we don't wind up with interlaced output
from two processes.

The need to bury a flush here is a sign that the abstraction needs redesign, but
that's a problem for a later date.

Signed-off-by: Brian Harring <ferringb@gmail.com>

commit ce43c70
Author: Brian Harring ferringb@gmail.com
Date: Tue Jan 10 01:42:00 2023 -0800

refactor(sync): hide FD passing as an internal thing.

Effectively, add '_spawn' and '_spawn_interactive' to the base class,
and expect consumers to invoke the appropriate one.

This addition doesn't fully fix the fundamental lack of an observer (or log)
based approach to getting info out of syncers, but it at least hides some of
the internals so the syncer classes can do things like knowing what the
correct encoding is for stdout, thus being able to write their own messages
to it.

TL;DR: This subsystem's interaction w/ CLI (and used as a library) needs rewriting,
this just reduces that problem when we visit it.

Signed-off-by: Brian Harring <ferringb@gmail.com>

commit fd03c41
Author: Brian Harring ferringb@gmail.com
Date: Tue Jan 10 01:36:48 2023 -0800

refactor(sync): Remove unused variable assignment.

We loop over the zip'd ips, but don't care about the actual
idx.

Signed-off-by: Brian Harring <ferringb@gmail.com>

@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Base: 53.67% // Head: 53.67% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (23a9857) compared to base (805b7c3).
Patch coverage: 88.00% of modified lines in pull request are covered.

❗ Current head 23a9857 differs from pull request most recent head bd47cb1. Consider uploading reports for the commit bd47cb1 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #394   +/-   ##
=======================================
  Coverage   53.67%   53.67%           
=======================================
  Files         138      138           
  Lines       21966    21963    -3     
  Branches     5183     5183           
=======================================
- Hits        11790    11789    -1     
+ Misses       9509     9507    -2     
  Partials      667      667           
Impacted Files Coverage Δ
src/pkgcore/sync/svn.py 36.95% <33.33%> (ø)
src/pkgcore/sync/rsync.py 64.53% <83.33%> (ø)
src/pkgcore/sync/base.py 90.20% <100.00%> (ø)
src/pkgcore/sync/http.py 20.45% <100.00%> (ø)
src/pkgcore/config/basics.py 93.03% <0.00%> (ø)
src/pkgcore/ebuild/portage_conf.py 36.30% <0.00%> (+0.02%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -143,7 +143,7 @@ def _sync(self, verbosity, output_fd):

# zip limits to the shortest iterable
ret = None
for count, ip in zip(range(self.retries), self._get_ips()):
for _, ip in zip(range(self.retries), self._get_ips()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will itertools.islice work here?

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 it would, thanks. I'll update shortly.

@arthurzam
Copy link
Member

2 later commits merged

We're only trying to limit the retries, thus use islice
instead.

Signed-off-by: Brian Harring <ferringb@gmail.com>
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.

None yet

2 participants