Comments (7)
Thanks for writing this in the first place. This tool already helped a log in getting rid of all my "maintain conda behind a tight firewall" problems.
from conda-mirror.
+1 for this feature.
It looks like https://github.com/maxpoint/conda-mirror/blob/master/conda_mirror/conda_mirror.py#L359 could be rewritten to a function:
def func_instead_of_inner_loop_validate(package):
# ensure the packages in this directory are in the upstream
# repodata.json
try:
package_metadata = package_repodata[package]
except KeyError:
logger.warning("%s is not in the upstream index. Removing...",
package)
_remove_package(os.path.join(package_directory, package),
reason="Package is not in the repodata index")
else:
# validate the integrity of the package, the size of the package and
# its hashes
logger.info('Validating package {}'.format(package)
_validate(os.path.join(package_directory, package),
md5=package_metadata.get('md5'),
size=package_metadata.get('size'))
(Note that I dropped idx
for now.)
This allows for using map(func_instead_of_inner_loop_validate, sorted(local_packages))
instead of the loop.
Then, multiprocessing.map
is all we need:
[...]
import multiprocessing
[...]
def _validate_packages(package_repodata, package_directory):
[...]
p = multiprocessing.Pool() # careful! This uses _all_ CPUs
p.map(func_instead_of_inner_loop_validate, sorted(local_packages))
p.close()
p.terminate()
p.join()
[...]
from conda-mirror.
I am working on it: #45. Won't make it past a very rough sketch today. I'll be busy the next two weeks but definitely get back to this at the end of April.
from conda-mirror.
You are 100% correct that parallelization would dramatically reduce the runtime. I did play around with adding such a feature but was not pleased with the increased complexity. Since I run this as a nightly cron job, the extra time is not posing a real issue for me at the moment. That being said, if you are interested in parallelizing the validation, I'd be more than happy to review the pull request.
from conda-mirror.
@willirath Thanks for the interest. That seems like a sensible solution. Would you be able to submit a PR with this code change and we can discuss its details in that PR?
from conda-mirror.
Awesome 🎉 ! Thanks for the effort. Ping me on the PR when you'd like some feedback.
from conda-mirror.
Closed by #48 . Thanks for the substantial effort here @willirath
from conda-mirror.
Related Issues (20)
- [BUG] Problematic implementation of the mirror
- [Optimization] Shuffle package validation order before validating
- keep old packages HOT 12
- Validation errors caused by incomplete tar file
- Question about Incremental Syncing HOT 5
- SSL Issue when creating mirror HOT 1
- sync only new packages HOT 8
- Specifying multiple platforms HOT 3
- How to catch stalling HTTP connections? HOT 1
- New release/version in pypi/conda-forge? HOT 3
- Release 0.8.0
- Cannot use conda-mirror behind proxy HOT 1
- Allow to filter packages based on the target Python version
- Fetching 'noarch' platform.
- Respect previous downloaded packages and generated `repodata.json`.
- Fetching necessary dependencies for the whitelist. HOT 1
- NOTYPE error of 'package'
- Issues with sha256 checksums HOT 2
- Support for .conda package mirroring HOT 1
- support https://anaconda.org/rapidsai
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conda-mirror.