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

Capture information on downloaded and removed packages #50

Merged
merged 5 commits into from May 18, 2017

Conversation

@ericdill
Copy link
Contributor

ericdill commented May 16, 2017

I want to know how many packages were removed and how many were successfully
downloaded without scraping the conda-mirror output. This PR enables that
functionality by having the main function keep track of what is removed and
what is downloaded and returning that information. By doing this, I can import
the main() function from conda-mirror and embed that in a script that parses
this output and does things (like alert me via some pathway) if conda-mirror
fails or removes a large number of packages or any other error condition I can
think of to make an alert off of.

@codecov

This comment has been minimized.

Copy link

codecov bot commented May 16, 2017

Codecov Report

Merging #50 into master will increase coverage by 1.83%.
The diff coverage is 87.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   94.53%   96.37%   +1.83%     
==========================================
  Files           2        2              
  Lines         238      248      +10     
==========================================
+ Hits          225      239      +14     
+ Misses         13        9       -4
Impacted Files Coverage Δ
conda_mirror/conda_mirror.py 96.32% <87.87%> (+1.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 586a0f4...5c1766d. Read the comment docs.

p.close()
p.join()

return [(path, reason) for path, reason in validation_results

This comment has been minimized.

Copy link
@parente

parente May 16, 2017

Collaborator

Add return section to docstring.

@parente

This comment has been minimized.

Copy link
Collaborator

parente commented May 16, 2017

No comments other than the one so far. Let me know if you want me to look again after it's not WIP.

@ericdill ericdill changed the title [WIP] Capture information on downloaded and removed packages Capture information on downloaded and removed packages May 17, 2017
@@ -215,12 +215,12 @@ def cli():
if args.version:
from . import __version__
print(__version__)
return
sys.exit(1)

This comment has been minimized.

Copy link
@parente

parente May 18, 2017

Collaborator

I always like the pattern of returning the exit code and then doing the sys.exit() in the main. That way there are no sudden exits playing hide-and-seek in the code when you're trying to, for example, test.

This comment has been minimized.

Copy link
@ericdill

ericdill May 18, 2017

Author Contributor

i dunno. checking the version is expected to end the program execution, no?

This comment has been minimized.

Copy link
@ericdill

ericdill May 18, 2017

Author Contributor

Discussed in person

@@ -505,7 +516,8 @@ def main(upstream_channel, target_directory, temp_directory, platform,
dict
Summary of what was removed and what was downloaded.
keys are:
- removed : set of (path, reason) for each package that was removed
- validation_results : set of (path, reason) for each package that was validated.

This comment has been minimized.

Copy link
@parente

parente May 18, 2017

Collaborator

Is reason a human readable string? A choice from a set of well-known strings (like an enum)?

This comment has been minimized.

Copy link
@ericdill

ericdill May 18, 2017

Author Contributor

human readable string

@ericdill ericdill merged commit f0e04e6 into Valassis-Digital-Media:master May 18, 2017
2 of 3 checks passed
2 of 3 checks passed
codecov/patch 87.87% of diff hit (target 94.53%)
Details
codecov/project 96.37% (+1.83%) compared to 586a0f4
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ericdill ericdill deleted the ericdill:return-mirror-info branch May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.