summaryrefslogtreecommitdiff
path: root/generate-cimonitor-dashboard.py
diff options
context:
space:
mode:
authorLaurent Alfonsi <laurent.alfonsi@linaro.org>2023-02-15 17:24:02 +0100
committerLaurent Alfonsi <laurent.alfonsi@linaro.org>2023-02-15 17:28:00 +0100
commita0860a094647ad5a6bc63cf4da77eaa59f87808b (patch)
tree60fa759f7bf87facdcc636d6c8a0b9399b8a3b8e /generate-cimonitor-dashboard.py
parentc00e83a330692deacd2c694459d3f3f4a8d5888c (diff)
generate-cimonitor-dashboard.py: improve again
Change-Id: Id3d13df1d455d3c79bb92c8c251e02d73ff82c7f
Diffstat (limited to 'generate-cimonitor-dashboard.py')
-rwxr-xr-xgenerate-cimonitor-dashboard.py82
1 files changed, 47 insertions, 35 deletions
diff --git a/generate-cimonitor-dashboard.py b/generate-cimonitor-dashboard.py
index c62a938a..b9b7f55d 100755
--- a/generate-cimonitor-dashboard.py
+++ b/generate-cimonitor-dashboard.py
@@ -141,7 +141,7 @@ Compute best message to display using internal ci-status representation
compute_smart_status()
Status reported can any stage of RR algorithm :
- init / success / reducing / bisected / forced / failure
+ init / success / reducing / bisecting / forced / failure
"""
def compute_smart_status(build):
ret_attr={'text':"-", 'hlink':"", 'class':"", 'color':""}
@@ -163,7 +163,7 @@ def compute_smart_status(build):
elif re.search(r'.*-init', displayname):
ret_attr['text']="INIT"
elif re.search(r'.*-trigger-bisect', displayname):
- ret_attr['text']="REGRESSED"
+ ret_attr['text']="BISECTING"
elif nb_components==1:
ret_attr['text']="REDUCING"
elif re.search(r'slowed down|grew in size|vect reduced|sve reduced|failed to build', displayname):
@@ -269,8 +269,8 @@ def compute_color(pjt_info_build, text):
# failure (normal flow)
elif re.search(r'FAILURE', text):
return "red"
-
- elif re.search(r'REGRESSED|REDUCING|BISECTED', text):
+
+ elif re.search(r'REGRESSED|REDUCING|BISECTING', text):
return "boldorange"
# Sucess (normal flow)
@@ -279,7 +279,7 @@ def compute_color(pjt_info_build, text):
elif not pjt_info_build or not pjt_info_build['result']:
return ""
-
+
elif re.search(r'ABORTED', pjt_info_build['result']):
return "purple"
elif re.search(r'SUCCESS', pjt_info_build['result']):
@@ -330,7 +330,9 @@ Retrieve the information from a given project out of the CI server
"""
def get_ci_project_infos(pjt_name):
ci_pjt={}
- usual_requests="?tree=number,result,timestamp,displayName,building,inQueue,builds[number,building,result,timestamp,displayName]"
+ usual_requests="?tree=number,result,timestamp,displayName,building,inQueue"
+ usual_requests+=",builds[number,building,result,timestamp,displayName]"
+ usual_requests+=",actions[causes[upstreamUrl,upstreamBuild]]"
ci_pjt=get_ci_page(ci_url_job+pjt_name, request=usual_requests)
ci_pjt['project_name']=pjt_name
@@ -338,17 +340,21 @@ def get_ci_project_infos(pjt_name):
if 'builds' not in ci_pjt: return ci_pjt
for bld in ci_pjt['builds']:
- compute_smart_status(bld)
- if 'lastCompletedBuild' not in ci_pjt and bld['result']:
+ if not bld['result']:
+ continue
+
+ if 'lastCompletedBuild' not in ci_pjt:
ci_pjt['lastCompletedBuild']=bld
- if 'lastSuccessfulBuild' not in ci_pjt and bld['result'] and bld['result']=='SUCCESS':
+ if 'lastSuccessfulBuild' not in ci_pjt and bld['result']=='SUCCESS':
ci_pjt['lastSuccessfulBuild']=bld
- if 'lastFailedBuild' not in ci_pjt and bld['result'] and not bld['result']=='SUCCESS':
+ if 'lastFailedBuild' not in ci_pjt and not bld['result']=='SUCCESS':
ci_pjt['lastFailedBuild']=bld
if 'lastRegressedBuild' not in ci_pjt and re.search(r'.*-trigger-bisect', bld['displayName']):
ci_pjt['lastRegressedBuild']=bld
+
bisect_name=re.sub("-build", r'-bisect', pjt_name)
bld2=get_ci_page(ci_url_job+bisect_name, request=usual_requests)
+ # May need to check if -bisect/lastBuild bld is the upstream of -build/lastRegressedBuild
ci_pjt['lastRegressedBuild']['bisectJob']={}
ci_pjt['lastRegressedBuild']['bisectJob']['project_name']=bisect_name
if 'inQueue' in bld2:
@@ -360,18 +366,19 @@ def get_ci_project_infos(pjt_name):
ci_pjt['lastRegressedBuild']['bisectJob']['timestamp']=bld2['builds'][0]['timestamp']
if 'lastForcedBuild' not in ci_pjt and re.match('.*-force', bld['displayName']):
ci_pjt['lastForcedBuild']=bld
- bld=get_ci_page(ci_url_job+pjt_name+"/"+str(bld['number']), request="?tree=actions[causes[upstreamUrl,upstreamBuild]]")
- if not bld: continue
- for action in bld['actions']:
+
+ bld2=get_ci_page(ci_url_job+pjt_name+"/"+str(bld['number']), request=usual_requests)
+ if not bld2: continue
+ for action in bld2['actions']:
if 'causes' in action:
for cause in action['causes']:
if 'upstreamUrl' in cause:
ci_pjt['lastForcedBuild']['upstreamUrl']=cause['upstreamUrl']
ci_pjt['lastForcedBuild']['upstreamBuild']=cause['upstreamBuild']
- bld2=get_ci_page(ci_url+cause['upstreamUrl']+str(cause['upstreamBuild']), request=usual_requests)
- if bld2:
- ci_pjt['lastForcedBuild']['upstreamBuildName']=bld2['displayName']
-
+ bld3=get_ci_page(ci_url+cause['upstreamUrl']+str(cause['upstreamBuild']), request=usual_requests)
+ if bld3:
+ ci_pjt['lastForcedBuild']['upstreamBuildName']=bld3['displayName']
+ compute_smart_status(bld)
return ci_pjt
@@ -384,8 +391,8 @@ Get one info from the CI server (1 project - 1 attribute)
def get_ci_project_attribute(pjt_infos, attr_name):
ret_attr={'text':"-", 'hlink':"", 'class':"", 'color':""}
- if True:
- #try:
+ #if True:
+ try:
if attr_name=="project":
ret_attr['text']=pjt_infos['project_name']
ret_attr['hlink']=ci_url_job+pjt_infos['project_name']
@@ -435,7 +442,7 @@ def get_ci_project_attribute(pjt_infos, attr_name):
total=total+1
if re.match('.*-force', bld['displayName']):
forced=forced+1
- ret_attr['text']="%.2f%% (%d/%d)"% (forced/total, forced, total)
+ ret_attr['text']="%02d%% (%d/%d)"% (int(forced/total*100), forced, total)
elif attr_name=="nb_fail":
total=0
@@ -456,14 +463,14 @@ def get_ci_project_attribute(pjt_infos, attr_name):
ret_attr['text']+=" / <a href="+lnk+">console</a>"
elif attr_name=="last_build":
- ret_attr['text']=str(days_since(pjt_infos['lastCompletedBuild']['timestamp'])) + " days ago"
+ ret_attr['text']="%02d days ago "%days_since(pjt_infos['lastCompletedBuild']['timestamp'])
elif attr_name=="last_success":
- ret_attr['text']=str(days_since(pjt_infos['lastSuccessfulBuild']['timestamp'])) + " days ago"
+ ret_attr['text']="%02d days ago "%days_since(pjt_infos['lastSuccessfulBuild']['timestamp'])
elif attr_name=="last_fail":
if 'lastFailedBuild' not in pjt_infos: return ret_attr
- ret_attr['text']=str(days_since(pjt_infos['lastFailedBuild']['timestamp'])) + " days ago"
+ ret_attr['text']="%02d days ago "%days_since(pjt_infos['lastFailedBuild']['timestamp'])
elif attr_name=="last_forced":
if 'lastForcedBuild' not in pjt_infos: return ret_attr
@@ -477,27 +484,32 @@ def get_ci_project_attribute(pjt_infos, attr_name):
matched=matched+1
ret_attr['text']+="(%d/%d) : "% (matched, total)
- lnk=ci_url_job+pjt_infos['project_name']+"/"+str(pjt_infos['lastForcedBuild']['number'])
- ret_attr['text']+="<a href="+lnk+">build</a>"
-
lnk=ci_url+pjt_infos['lastForcedBuild']['upstreamUrl']+str(pjt_infos['lastForcedBuild']['upstreamBuild'])
- ret_attr['text']+="/ <a href="+lnk+">bisect</a>"
+
+ ret_attr['text']+="<a href="+lnk+">bisect : </a>"
bldname=pjt_infos['lastForcedBuild']['upstreamBuildName']
if re.match(r'.*spurious|.*baseline', bldname):
bldname=re.sub("#([0-9]*)-(.*)-(.*)", r'\2-\3', bldname)
- ret_attr['text']+=" / "+bldname
+ ret_attr['text']+=bldname
else:
compon=re.sub("#([0-9]*)-(.*)-(.*)", r'\2', bldname)
sha1=re.sub("#([0-9]*)-(.*)-(.*)", r'\3', bldname)
+ bldname = compon+"-"+sha1[0:7]
+
+ if re.match('tcwg_bmk.*speed', pjt_infos['project_name']):
+ ret_attr['text']+=bldname
+ else:
+ lnk="https://git.linaro.org/toolchain/ci/interesting-commits.git/tree/%s/sha1/%s"%(compon, sha1)
+ ret_attr['text']+="<a href="+lnk+">"+bldname+"</a>"
- lnk="https://git.linaro.org/toolchain/ci/interesting-commits.git/tree/%s/sha1/%s"%(compon, sha1)
- ret_attr['text']+=" / <a href="+lnk+">regression</a>"
+ lnk=ci_url_job+pjt_infos['project_name']+"/"+str(pjt_infos['lastForcedBuild']['number'])
+ ret_attr['text']+=" / <a href="+lnk+">"+str(pjt_infos['lastForcedBuild']['displayName'])+"</a>"
elif attr_name=="last_regressed":
if 'lastRegressedBuild' not in pjt_infos: return ret_attr
ret_attr['text']="%02d days ago "%days_since(pjt_infos['lastRegressedBuild']['timestamp'])
-
+
total=0
matched=0
for bld in pjt_infos['builds']:
@@ -527,7 +539,7 @@ def get_ci_project_attribute(pjt_infos, attr_name):
state="(running)"
elif not bisect_job['result']=="SUCCESS":
lnk+="/lastBuild"
- state="(failed)"
+ state="(failed)"
elif re.match('.*-spurious|.*-advance-baseline', bisect_job['displayName']):
lnk+="/lastBuild"
state="(spurious)"
@@ -536,7 +548,7 @@ def get_ci_project_attribute(pjt_infos, attr_name):
state="(ok)"
else:
lnk+="/lastBuild"
- print(bisect_job)
+ #print(bisect_job)
state="("+bisect_job['displayName']+")"
ret_attr['text']+="<a href="+lnk+">bisect"+state+"</a> / "
@@ -589,8 +601,8 @@ def get_ci_project_attribute(pjt_infos, attr_name):
elif attr_name=="failing_step":
ret_attr=compute_smart_diag(pjt_infos)
- #except:
- # ret_attr['text']="-"
+ except:
+ ret_attr['text']="-"
return ret_attr