@@ -404,6 +404,7 @@ def remove_notes_if_no_notes(_record_rows, _record_headers):
404404 else :
405405 for j , record_id in enumerate (record_ids ):
406406 rows .append ([str (i ) if j == 0 else '' , j , exp_id if j == 0 else '' ]+ row_func (record_id , headers , raise_display_errors = self .raise_display_errors , truncate_to = self .truncate_result_to , ignore_valid_keys = self .ignore_valid_keys ))
407+ assert len (rows [0 ])== len (full_headers )
407408 rows , full_headers = remove_notes_if_no_notes (rows , full_headers )
408409
409410 if self .table_package == 'pretty_table' :
@@ -745,20 +746,23 @@ def _get_record_rows_cached(record_id, headers, raise_display_errors, truncate_t
745746 if os .path .exists (path ):
746747 try :
747748 with open (path , 'rb' ) as f :
748- info = pickle .load (f )
749- return info
749+ record_rows = pickle .load (f )
750+ if len (record_rows )!= len (headers ):
751+ os .remove (path ) # This should never happen. But in case it somehow does, we just go ahead and compute again.
752+ else :
753+ return record_rows
750754 except :
751755 logging .warn ('Failed to load cached record info: {}' .format (record_id ))
752756
753757 info_plus_status = _get_record_rows (record_id = record_id , headers = headers + [ExpRecordDisplayFields .STATUS ],
754758 raise_display_errors = raise_display_errors , truncate_to = truncate_to , ignore_valid_keys = ignore_valid_keys )
755- info , status = info_plus_status [:- 1 ], info_plus_status [- 1 ]
759+ record_rows , status = info_plus_status [:- 1 ], info_plus_status [- 1 ]
756760 if status == ExpStatusOptions .STARTED : # In this case it's still running (maybe) and we don't want to cache because it'll change
757- return info
761+ return record_rows
758762 else :
759763 with open (path , 'wb' ) as f :
760- pickle .dump (info [: - 1 ] , f )
761- return info
764+ pickle .dump (record_rows , f )
765+ return record_rows
762766
763767
764768def browse_experiment_records (* args , ** kwargs ):
0 commit comments