diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index cf8b2f16..7f337853 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -5,6 +5,15 @@ Change Log All notable changes to this project are documented in this file. +=================== +21.2.1 - 2024-10-08 +=================== + +Fixed +----- +- Fix fetching ``qc`` data from deploys with local data storage + + =================== 21.2.0 - 2024-07-10 =================== diff --git a/src/resdk/tables/utils.py b/src/resdk/tables/utils.py index 4a8cc1b5..86add053 100644 --- a/src/resdk/tables/utils.py +++ b/src/resdk/tables/utils.py @@ -3,7 +3,7 @@ import asyncio import json from io import BytesIO -from urllib.parse import urljoin +from urllib.parse import urljoin, urlparse import aiohttp import pandas as pd @@ -32,6 +32,11 @@ def _uri_to_url(resolwe, uris): return json.loads(response.content.decode("utf-8")) +def is_absolute(url: str) -> bool: + """Return if the given URL absolute.""" + return bool(urlparse(url).netloc) + + async def _batch_download(resolwe, uris, parser) -> pd.DataFrame: """Download multiple files defined by their uri asynchronously.""" try: @@ -39,9 +44,13 @@ async def _batch_download(resolwe, uris, parser) -> pd.DataFrame: except HTTPError: return pd.DataFrame() - async with aiohttp.ClientSession() as session: + def prepare_url(url): + """Prepent the base url if it is not absolute.""" + return url if is_absolute(url) else urljoin(resolwe.url, url) + + async with aiohttp.ClientSession(cookies=resolwe.session.cookies) as session: futures = [ - _download_file(uri, url, session, parser) + _download_file(uri, prepare_url(url), session, parser) for uri, url in uri_to_url.items() if url ] diff --git a/tests/functional/docs/e2e_docs.py b/tests/functional/docs/e2e_docs.py index 1842b2d2..565ffa75 100644 --- a/tests/functional/docs/e2e_docs.py +++ b/tests/functional/docs/e2e_docs.py @@ -212,9 +212,8 @@ def setUp(self): self.allow_run_process(self.res, "upload-fastq-single") self.allow_run_process(self.res, "alignment-star") self.allow_run_process(self.res, "workflow-bbduk-star-featurecounts-qc") - # Set permissions for using descriptor_schemas: + # Set permissions for using descriptor_schema. self.allow_use_descriptor_schema(self.res, "reads") - self.allow_use_descriptor_schema(self.res, "sample") def test_tutorial_create(self): """Test tutorial-create."""