Skip to content

Commit

Permalink
Improve robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Damian authored and Adrian Damian committed Feb 25, 2025
1 parent 24a6b7d commit 3456a9a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pyvo/dal/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def update_results_resource(tb, fields, rows):
session=self._session,
original_row=row)
remaining_ids = self.query['ID']
# self.query['ID'] = remaining_ids[:1] # batch size 1
if not remaining_ids:
# we are done
return

Check warning on line 210 in pyvo/dal/adhoc.py

View check run for this annotation

Codecov / codecov/patch

pyvo/dal/adhoc.py#L210

Added line #L210 was not covered by tests
Expand All @@ -217,6 +218,7 @@ def update_results_resource(tb, fields, rows):
', '.join([_ for _ in remaining_ids])))
batch_size = len(current_ids) # this could be set by the datalink service
while remaining_ids:
start_remaining_ids = len(remaining_ids)
copy_tb = VOTableFile()
res_votable = current_batch.votable.get_first_table()
# now remove unreferenced services from resources
Expand Down Expand Up @@ -253,6 +255,11 @@ def update_results_resource(tb, fields, rows):
yield DatalinkResults(copy_tb, original_row=original_row)
if not remaining_ids:
return # we are done
if len(remaining_ids) == start_remaining_ids:
# no progress
raise DALServiceError(

Check warning on line 260 in pyvo/dal/adhoc.py

View check run for this annotation

Codecov / codecov/patch

pyvo/dal/adhoc.py#L260

Added line #L260 was not covered by tests
'Could not retrieve datalinks for: {}'.format(
', '.join([_ for _ in remaining_ids])))
self.query['ID'] = remaining_ids[:batch_size]
current_batch = self.query.execute(post=True)
if not current_batch:
Expand Down

0 comments on commit 3456a9a

Please sign in to comment.