Commit 65af41e3 authored by Andreas Tille's avatar Andreas Tille

Waiting for Salsa 1800 seconds

parent 2d70542a
......@@ -54,7 +54,7 @@ READMEDEBIANARCHIVE='/srv/blends.debian.org/www/_'+TDNAME+'/README.Debian.tar.xz
TARGETDIR=os.path.join(os.environ['HOME'],TDNAME)
SLEEPTIME=1
SLEEPUNTILRETRY=3600
SLEEPUNTILRETRY=1800
debug=0
# do not clean dirs. FIXME: Find a method to detect removed repositories and clean this up here
......@@ -63,6 +63,10 @@ try:
except:
pass
def wait_for_salsa():
time.sleep(SLEEPUNTILRETRY)
print("Received GitlabGetError: 429 - Retry later ... waiting for %i seconds" % SLEEPUNTILRETRY )
def get_blends_groups():
blends_groups=[]
groups = gl.groups.list(all=True, order_by='name', sort='asc')
......@@ -87,8 +91,7 @@ def output_metadata(subdir, metadata):
try:
file_info = project.repository_blob(item['id'])
except gitlab.exceptions.GitlabGetError:
time.sleep(SLEEPUNTILRETRY)
print("Received GitlabGetError: 429 - Retry later ... waiting for %i seconds" % SLEEPUNTILRETRY )
wait_for_salsa()
file_info = project.repository_blob(item['id'])
content = base64.b64decode(file_info['content'])
if item['name'] == 'metadata':
......@@ -117,7 +120,11 @@ for group in blends_groups:
# projects = group.projects.list(page=1, per_page=10, order_by='name', sort='asc')
print("%s has %i projects (Blend name %s)" % (group.attributes['name'], len(projects), blend)) # group.attributes['id'], group.attributes['path']) # , group.attributes['description'], group.attributes['full_name'])
for pr in projects:
project = gl.projects.get(pr.attributes['id']) # without this extra get repository_tree() fails
try:
project = gl.projects.get(pr.attributes['id']) # without this extra get repository_tree() fails
except gitlab.exceptions.GitlabGetError:
wait_for_salsa()
project = gl.projects.get(pr.attributes['id']) # without this extra get repository_tree() fails
name = project.attributes['name']
namedir = os.path.join(TARGETDIR, name[0])
if not os.path.exists(namedir):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment