Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions htsget_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from clinical_etl.schema import openapi_to_jsonschema
import jsonschema
from candigv2_logging.logging import CanDIGLogger
from requests.exceptions import ConnectTimeout


logger = CanDIGLogger(__file__)
Expand Down Expand Up @@ -311,9 +312,15 @@ def parse_s3_url(url):
data["object"] = object[0]
if len(object) > 1:
data["object"] = object[0]
response, status_code = get_s3_url(s3_endpoint=data["endpoint"], bucket=data["bucket"], object_id=data["object"], access_key=None, secret_key=None, region=None, public=True)
try:
response, status_code = get_s3_url(s3_endpoint=data["endpoint"], bucket=data["bucket"], object_id=data["object"], access_key=None, secret_key=None, region=None, public=True)
except ConnectTimeout as e:
raise Exception(f"Could not read {data["object"]}: {e}")
else:
response, status_code = get_s3_url(s3_endpoint=data["endpoint"], bucket=data["bucket"], object_id=data["object"], access_key=None, secret_key=None, region=None, public=False)
try:
response, status_code = get_s3_url(s3_endpoint=data["endpoint"], bucket=data["bucket"], object_id=data["object"], access_key=None, secret_key=None, region=None, public=False)
except ConnectTimeout as e:
raise Exception(f"Could not read {data["object"]}: {e}")

if status_code == 500:
raise Exception(response["error"])
Expand Down Expand Up @@ -509,6 +516,7 @@ def check_genomic_data(dataset, token):
result["errors"][program_id].append({analysis["analysis_id"]: sample_errors})
if len(result["errors"][program_id]) == 0:
result["errors"].pop(program_id)

if len(result["errors"]) == 0:
return by_program, 200
return result, 400
Expand Down Expand Up @@ -541,5 +549,6 @@ def main():
result, status_code = htsget_ingest(result)
print(json.dumps(result, indent=4))


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
requests==2.32.4
requests-mock>=1.12.1
candigv2-authx@git+https://github.com/CanDIG/candigv2-authx.git@v2.8.7
clinical_etl@git+https://github.com/CanDIG/clinical_ETL_code.git@v3.2.0
clinical_etl@git+https://github.com/CanDIG/clinical_ETL_code.git@v3.4.0
candigv2-logging@git+https://github.com/CanDIG/candigv2-logging.git@v1.0.3
Loading