Comments (6)
I already catch some errors with it :P
from gns3-registry.
We probably need to speed up stuff in the futur
from gns3-registry.
Reason for this slowness is that the http HEAD request is only done on the original web address. If this returns a redirection, the python urllib does a GET on the new address. That means, that your check does a full download on all images, that are hosted on sourceforge and other sites, that are using redirection.
So either we should tell this script to do no redirection or it should do HEAD requests also on redirected addresses.
from gns3-registry.
Well, I was wrong that the images are downloaded, when a redirection occurs. Nevertheless a GET is issued, what increases the traffic. But that's not the reason for the slowness.
It seems, that some web sites, especially when using https, are not really fast. If redirection takes place, this increases even more. On my system it takes 36 sec for the checks, what's quite a lot.
I searched with google to a way to remove the redirection. I found something, no idea if it's good code. Additionally I check each web site only once. This brings the time for check.py down to 10 sec. When we want to be even faster, we need parallel requests.
He my quick-and-dirty changes
--- check.py.orig 2015-10-13 20:21:51.000000000 +0200
+++ check.py 2015-10-14 00:22:28.000000000 +0200
@@ -22,14 +22,28 @@
import subprocess
import urllib.request
+class MyHTTPRedirectHandler(urllib.request.HTTPRedirectHandler):
+ def redirect_request(self, req, fp, code, msg, hdrs, newurl):
+ return None
+
+urllib.request.install_opener(urllib.request.build_opener(MyHTTPRedirectHandler))
def check_url(url, appliance):
+ if url in check_url.url_ok:
+ return
try:
req = urllib.request.Request(url, method='HEAD')
urllib.request.urlopen(req)
- except (urllib.error.HTTPError, urllib.error.URLError):
- print('Error with url ' + url + ' in appliance ' + appliance)
+ except urllib.error.HTTPError as err:
+ if err.getcode() >= 400:
+ print('Error with url ' + url + ' - ' + str(err))
+ sys.exit(1)
+ except urllib.error.URLError:
+ print('Invalid URL ' + url)
sys.exit(1)
+ check_url.url_ok[url] = True
+
+check_url.url_ok={}
def check_appliance(appliance):```
from gns3-registry.
Thanks for the patch. I have removed the cache of check because now I use multiprocessing and I need to rewrite the cache to support shared data between process.
from gns3-registry.
It's also slower because I discover some url wassn't check properly
from gns3-registry.
Related Issues (20)
- docker adosztal network automation is recommended not to be used in an exported project - especially on windows HOT 1
- Remove the opendaylight image on DockerHub HOT 1
- please do not quickly delete or rename dockers
- Retry on communication errors for docker build tool HOT 2
- Maintainer for vyos appliance wanted HOT 13
- Add "-cpu host" to all RedHat based appliances HOT 3
- Add vendor_logo_url in registry
- Purge Old Images from the appliances I Update? HOT 2
- Outdated Docker Images
- Schema 6 update in PR #732 missing in schema 7 and 8 HOT 1
- Latest FortiGate Images for GNS3 HOT 2
- Tinycore appliance upgrade or an alternative thin linux appliance HOT 3
- IOU VM "IOU1" process has stopped with return code: -6 (IOU L2 v17.12.1) HOT 21
- Adding Open VSwitch appliance bash completion HOT 1
- Docker image pyats fails to build on latest ubuntu 24.04 (noble) HOT 1
- Multiple issues in Open vSwitch appliance HOT 1
- Update of GitHub Action workflows needed
- feature request:show the sha256sums of the Appliances in the marketplace HOT 1
- Alpine cloudinit image option HOT 5
- FortiGate 7.4.4 wrong build number HOT 3
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 gns3-registry.