-
Notifications
You must be signed in to change notification settings - Fork 60
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
Handle fully qualified channels #25
Handle fully qualified channels #25
Conversation
Alright here's the full super-duper magic git install command that will pip install this from the branch on my fork:
|
Just gave this a try. Everything was working well until it got past the validation of the downloaded packages and yielded this in the output:
Downloading that repodata.json file (which has an empty packages key and doesn't match the repodata.json file found under https://repo.continuum.io/pkgs/prolinux-64/repodata.json) overwrote the good repodata.json file from the continuum.io site. So all the packages were downloaded and validated as expected, but the metadata is getting lost. (Also, not sure why those repodata.json files don't match or why the one from conda.anaconda.org would have an empty packages key...?) Maybe instead of using the REPODATA url the DOWNLOAD_URL var could just have repodata.json appended to the end? From what I understand, repodata.json is always hosted in the channel's arch directory, no? |
Awesome commenting by the way - was easy to find the line that was causing this. Not sure if my suggestion would work 100% of the time, though, given the uses of REPODATA. I plan to look closer on Monday if you don't get a chance to comment before then. |
thanks :)
That's the totally wrong url 😞
Yup. That's a good idea. I'll push up a change shortly and ping you again
That is my understanding as well |
Also update the docs and general clean up
- Fake a noarch channel since conda appears to need that now
Alright turns out that was bit more work than expected. |
Just tried it out and it works great on the pro repo. I'll probably switch free over to using the URL approach, too. I did find one issue, but it was so small a PR seemed excessive :)
|
Excellent. Thanks for being a beta tester 😁 re: I'll update the tests today, merge this and cut a release |
Awesome! And just in time for me to setup my crontabs :) Thanks! |
@dmarkwat Hah so turns out it was actually very simple to fix up the test suite. I was honestly expecting it to be very broken. Any more comments on this PR? |
Codecov Report@@ Coverage Diff @@
## master #25 +/- ##
==========================================
- Coverage 92.59% 90.12% -2.47%
==========================================
Files 2 2
Lines 216 243 +27
==========================================
+ Hits 200 219 +19
- Misses 16 24 +8
Continue to review full report at Codecov.
|
url = default_url_base + url_suffix | ||
return url, channel | ||
# looks like we are being given a fully qualified channel | ||
download_base, channel = channel.rsplit('/', 1) |
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.
Would using any of the urllib.parse functions like urljoin make this more robust?
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.
"This" meaning the code in this function.
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.
Yes perhaps. I have not used any of that before
conda_mirror/conda_mirror.py
Outdated
@@ -273,29 +355,56 @@ def _download(url, target_directory, package_metadata=None, validate=True, | |||
|
|||
|
|||
def _list_conda_packages(local_dir): | |||
"""List the conda packages (*.tar.bz2 files) in `local_dir |
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.
Missing `.
"""Validate local conda packages. | ||
|
||
NOTE: This is slow. | ||
NOTE2: This will remove any packages that are in `package_directory` that |
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.
It will also remove any packages that fail validation because that's what _validate
does. Maybe worth mentioning?
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.
updated
No extra comments from me; all is working as expected from what I can tell. Thanks for the help! |
no flag: ERROR only -v: WARNING + ERROR -vv: INFO + WARNING + ERROR -vvv: DEBUG + INFO + WARNING + ERROR
conda_mirror/conda_mirror.py
Outdated
@@ -262,6 +262,10 @@ def _get_output(cmd): | |||
except subprocess.CalledProcessError as cpe: | |||
logger.exception(cpe.output.decode()) | |||
return "" | |||
except Exception: | |||
msg = "Error in subprocess.check_output. cmd: '%s'" | |||
logger.exception(msg, ' '.join(cmd)) |
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.
Hehe. 👍
Thanks @parente |
@dmarkwat 0.6.2 is tagged and on pypi that contains these changes. please give it a spin and let me know if anything is broken! There are some new logging features that allow you to watch for specific lines. "WARNING:" lines show only packages that failed validation. "ERROR:" lines are unexpected stack traces and so should be monitored for. You'll probably want to update your cron scripts to include a "-v" flag to enable WARNING level messages |
Just ran the mirrors today and everything is looking great. Actually ran it a number of times and it works as expected. Flipped on the debug logging so I know that works, too. Thanks again! |
Can you give this branch a try @dmarkwat? I haven't finished fixing up the test suite to allow fully qualified channels like this, but I'm pretty sure it's functional. This should enable you to pass fully qualified channels like
or the pro one, in your case.
(I think) you can install this with
pip install git+https://github.com/ericdill/conda-mirror@issue25/conda-mirror
. Will make sure after I open the PR and update this if need be