File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -287,35 +287,27 @@ variable FIREDRAKE_GITHUB_TOKEN to a github personal access token.""")
287287
288288
289289def zenodo_records ():
290- """Grab all zenodo records of tagged Firedrake component releases.
290+ """Grab the 100 most recent zenodo records of tagged Firedrake component releases.
291291
292292 :returns: An iterable of zenodo records.
293- :raises LookupError: if we were not able find any records."""
294- result = None
295- i = 1
296- while True :
297- if i > 8000 // 25 :
298- raise RuntimeError ("More than 8000 uploads on zenodo?" )
293+ :raises LookupError: if we were not able find any records.
294+
295+ We only load the 100 most recent tags to avoid running into rate-limiter issues
296+ from Zenodo.
297+
298+ """
299+ result = []
300+ for i in range (1 , 5 ):
299301 response = requests .get (f"{ ZENODO_URL } /records" , params = {"q" : 'owners:19586 OR owners:19587' ,
300302 "all_versions" : True ,
301303 "size" : 25 ,
302304 "sort" : "mostrecent" ,
303305 "page" : i })
304306 if response .status_code == 200 :
305- if result is None :
306- result = response .json ()
307- else :
308- tmp = response .json ()
309- result ["hits" ]["hits" ].extend (tmp ["hits" ]["hits" ])
310- n = len (result ["hits" ]["hits" ])
311- expect = result ["hits" ]["total" ]
312- if expect == n :
313- return result ["hits" ]["hits" ]
314- elif expect < n :
315- raise LookupError ("Have more hits than Zenodo reports in total" )
316- i += 1
307+ result .extend (response .json ()["hits" ]["hits" ])
317308 else :
318309 raise LookupError ("Unable to get zenodo records: %s" % response .json ())
310+ return result
319311
320312
321313def zenodo_metarecords ():
You can’t perform that action at this time.
0 commit comments