@@ -126,43 +126,41 @@ def get_run_start_tf(run):
126126 return objects [0 ]["STF" ]
127127
128128
129- def ccdb_cross_check (run , path , not_after , timeout = 15 ):
129+ def ccdb_cross_check (run , path , not_after ):
130130 """Report which object a correctly time-machine-pinned query at not_after
131131 would actually resolve to, and flag if CCDB has since been updated for the
132132 same validity window. Never raises; returns None on any failure."""
133133 timestamp = get_run_start_tf (run )
134134 url = f"{ CCDB_HOST } /browse/{ path } /{ timestamp } "
135- result = {"timestamp" : timestamp }
136135
137136 objects = get_ccdb_objects (url )
138137 if not objects :
139- result .update ({"error" : "no CCDB object covers this instant" })
138+ print_warning (f"CCDB cross-check on { path } /{ timestamp } skipped: "
139+ "no CCDB object covers this instant" )
140+ return
140141
141- as_of = [o for o in objects if o .get ("Created" , 0 ) <= not_after ]
142+ as_of_candidates = [o for o in objects if o .get ("Created" , 0 ) <= not_after ]
142143 newest = max (objects , key = lambda o : o .get ("Created" , 0 ))
143- result .update ({"newest" : newest , "as_of" : None , "outdated" : False })
144- if as_of :
145- result ["as_of" ] = max (as_of , key = lambda o : o .get ("Created" , 0 ))
146- result ["outdated" ] = newest ["Created" ] > result ["as_of" ]["Created" ]
147-
148- check_timestamp = f"/{ result ['timestamp' ]} " if result else ""
149- if result is None or "error" in result :
150- reason = result ["error" ] if result else "unknown error"
151- print_warning (f"CCDB cross-check on { path } { check_timestamp } skipped: { reason } " )
152- elif result ["as_of" ] is None :
153- print_info (f"CCDB cross-check on { path } { check_timestamp } : no object existed "
154- f"yet at the recommended timestamp (newest is { describe_object (result ['newest' ])} )" )
144+ as_of = None
145+ outdated = False
146+ if as_of_candidates :
147+ as_of = max (as_of_candidates , key = lambda o : o .get ("Created" , 0 ))
148+ outdated = newest .get ("Created" , 0 ) > as_of .get ("Created" , 0 )
149+
150+ if as_of is None :
151+ print_info (f"CCDB cross-check on { path } /{ timestamp } : no object existed "
152+ f"yet at the recommended timestamp (newest is { describe_object (newest )} )" )
155153 else :
156- print_info (f"CCDB cross-check on { path } { check_timestamp } : as-of object is "
157- f"{ describe_object (result [ ' as_of' ] )} " )
158- if result [ " outdated" ] :
154+ print_info (f"CCDB cross-check on { path } / { timestamp } : as-of object is "
155+ f"{ describe_object (as_of )} " )
156+ if outdated :
159157 print_info (f"CCDB's current object for this window is newer "
160- f"({ describe_object (result [ ' newest' ] )} ) - it postdates this pass's processing and "
158+ f"({ describe_object (newest )} ) - it postdates this pass's processing and "
161159 f"was not what this run actually saw." )
162160
163161
164162def describe_object (o ):
165- return (f"Created { human (o [ 'Created' ] )} , JIRA={ o .get ('JIRA' , '?' )} , "
163+ return (f"Created { human (o . get ( 'Created' , 0 ) )} , JIRA={ o .get ('JIRA' , '?' )} , "
166164 f"comment=\" { o .get ('comment' , '' )} \" " )
167165
168166
0 commit comments