cnr-ibba/IMAGE-InjectTool

:bug: task SearchOrphanTask raises error

Closed this issue · 0 comments

bunop commented

Describe the bug
Periodic task SearchOrphanTask raise errors when executing: the BioSample url https://www.ebi.ac.uk/biosamples/samples now returns a different page, without the page section

To Reproduce
Steps to reproduce the behavior:

  1. Oper the admin interface
  2. Search for periodic task section
  3. Select and execute the search_orphan_biosamples peridic task

Expected behavior
Task need to be executed without errors. No notification emails need to be sent

Screenshots

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/celery/app/trace.py", line 412, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/celery/app/trace.py", line 704, in __protected_call__
    return self.run(*args, **kwargs)
  File "/var/uwsgi/image/common/tasks.py", line 211, in wrapped_f
    result = f(*args, **kwargs)
  File "/var/uwsgi/image/biosample/tasks/cleanup.py", line 357, in run
    loop.run_until_complete(check_samples())
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 488, in run_until_complete
    return future.result()
  File "/var/uwsgi/image/biosample/tasks/cleanup.py", line 284, in check_samples
    async for sample in get_biosamples(managed_domains=managed_domains):
  File "/var/uwsgi/image/biosample/tasks/cleanup.py", line 238, in get_biosamples
    totalPages = data['page']['totalPages']
KeyError: 'page'

Additional context

Stuff can be solved as IMAGE-CommonDataPool does, by querying accession endpoint before and then check for each biosample object.