Changeset 86950 in vbox
- Timestamp:
- Nov 20, 2020 7:21:17 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141469
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/cgi/status.py
r86941 r86950 160 160 161 161 162 def format_data(target_dict): 163 content = "" 164 for key in target_dict: 165 if "hours_running" in target_dict[key].keys(): 166 content += "{};{};{} | running: {};{} | success: {} | skipped: {} | ".format(key, 167 target_dict[key]["testbox_os"], 168 target_dict[key]["sched_group"], 169 target_dict[key]["running"], 170 target_dict[key]["hours_running"], 171 target_dict[key]["success"], 172 target_dict[key]["skipped"], 173 ) 174 elif "testbox_os" in target_dict[key].keys(): 175 content += "{};{};{} | running: {} | success: {} | skipped: {} | ".format(key, 176 target_dict[key]["testbox_os"], 177 target_dict[key]["sched_group"], 178 target_dict[key]["running"], 179 target_dict[key]["success"], 180 target_dict[key]["skipped"], 181 ) 162 def formatDataEntry(sKey, dEntry): 163 # There are variations in the first and second "columns". 164 if "hours_running" in dEntry: 165 sRet = "%s;%s;%s | running: %s;%s" \ 166 % (sKey, dEntry["testbox_os"], dEntry["sched_group"], dEntry["running"], dEntry["hours_running"]); 167 else: 168 if "testbox_os" in dEntry: 169 sRet = "%s;%s;%s" % (sKey, dEntry["testbox_os"], dEntry["sched_group"],); 182 170 else: 183 content += "{} | running: {} | success: {} | skipped: {} | ".format(key, 184 target_dict[key]["running"], 185 target_dict[key]["success"], 186 target_dict[key]["skipped"], 187 ) 188 content += "bad-testbox: {} | aborted: {} | failure: {} | ".format( 189 target_dict[key]["bad-testbox"], 190 target_dict[key]["aborted"], 191 target_dict[key]["failure"], 192 ) 193 content += "timed-out: {} | rebooted: {} | \n".format( 194 target_dict[key]["timed-out"], 195 target_dict[key]["rebooted"], 196 ) 197 return content 171 sRet = sKey; 172 sRet += " | running: %s" % (dEntry["running"],) 173 174 # The rest is currently identical: 175 sRet += " | success: %s | skipped: %s | bad-testbox: %s | aborted: %s | failure: %s | timed-out: %s | rebooted: %s | \n" \ 176 % (dEntry["success"], dEntry["skipped"], dEntry["bad-testbox"], dEntry["aborted"], 177 dEntry["failure"], dEntry["timed-out"], dEntry["rebooted"],); 178 return sRet; 179 180 181 def format_data(dData, fSorted): 182 sRet = ""; 183 if not fSorted: 184 for sKey in dData: 185 sRet += formatDataEntry(sKey, dData[sKey]); 186 else: 187 for sKey in sorted(dData.keys()): 188 sRet += formatDataEntry(sKey, dData[sKey]); 189 return sRet; 198 190 199 191 ###### … … 274 266 return iValue; 275 267 268 def _getBoolParam(self, sName, fDefValue = None): 269 """ 270 Gets a boolean parameter. 271 272 Raises exception if not found and no default is provided, or if not a 273 valid boolean. 274 """ 275 sValue = self._getStringParam(sName, [ 'True', 'true', '1', 'False', 'false', '0'], sDefValue = str(fDefValue)); 276 return sValue in ('True', 'true', '1',); 277 276 278 def _checkForUnknownParameters(self): 277 279 """ … … 308 310 # 309 311 cHoursBack = self._getIntParam('cHours', 1, 24*14, 12); 312 fSorted = self._getBoolParam('fSorted', False); 310 313 self._checkForUnknownParameters(); 311 314 … … 393 396 WHERE TestBoxesWithStrings.tsExpire = 'infinity'::TIMESTAMP 394 397 AND SchedGroupNames.idTestBox = TestBoxesWithStrings.idTestBox 395 )''', (cHoursBack, cHoursBack,)); 398 ) 399 ''', (cHoursBack, cHoursBack,)); 396 400 397 401 … … 401 405 dResult = testbox_data_processing(oDb); 402 406 self._oSrvGlue.setContentType('text/plain'); 403 self._oSrvGlue.write(format_data(dResult ));407 self._oSrvGlue.write(format_data(dResult, fSorted)); 404 408 405 409 return True; … … 415 419 sBranch = self._getStringParam('sBranch'); 416 420 cHoursBack = self._getIntParam('cHours', 1, 24*14, 6); ## @todo why 6 hours here and 12 for test boxes? 421 fSorted = self._getBoolParam('fSorted', False); 417 422 self._checkForUnknownParameters(); 418 423 … … 470 475 # Format and output it. 471 476 self._oSrvGlue.setContentType('text/plain'); 472 self._oSrvGlue.write(format_data(dResult ));477 self._oSrvGlue.write(format_data(dResult, fSorted)); 473 478 474 479 return True;
Note:
See TracChangeset
for help on using the changeset viewer.