Commit 36cd03d7 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: add a retry to get build id

No related merge requests found
Showing with 11 additions and 4 deletions
+11 -4
...@@ -26,6 +26,7 @@ import re ...@@ -26,6 +26,7 @@ import re
import unittest import unittest
import sys import sys
import json import json
import time
trace = False trace = False
...@@ -176,11 +177,17 @@ site:"+site+", stamp:"+stamp+", name:"+name+", project:"+project+".") ...@@ -176,11 +177,17 @@ site:"+site+", stamp:"+stamp+", name:"+name+", project:"+project+".")
full_url = self.url + buildid_api + buildid_params full_url = self.url + buildid_api + buildid_params
if trace: if trace:
print("full_url: "+full_url) print("full_url: "+full_url)
response = urllib.request.urlopen(full_url).read().decode() nb_try = 3
if trace:
print ( "response: " + response )
build_id_regex = re.compile( "<buildid>([0-9]+)</buildid>" ) build_id_regex = re.compile( "<buildid>([0-9]+)</buildid>" )
buildid = build_id_regex.search( response ) while nb_try:
response = urllib.request.urlopen(full_url).read().decode()
if trace:
print ( "response: " + response )
buildid = build_id_regex.search( response )
nb_try -= 1
if buildid or (nb_try == 0):
break
time.sleep(60)
if buildid: if buildid:
self.buildid = buildid.group(1) self.buildid = buildid.group(1)
if trace: if trace:
......
Supports Markdown
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