Skip to content

Commit

Permalink
Change s3 timeout values (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed Apr 22, 2022
1 parent 99e811a commit a87971f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mp_api/client.py
Expand Up @@ -1062,13 +1062,13 @@ def get_charge_density_from_material_id(self, material_id: str, inc_task_doc: bo
# density data from a private S3 bucket. Else, we pull data
# from public MinIO buckets.
if environ.get("AWS_EXECUTION_ENV", None) == "AWS_ECS_FARGATE":
r = get(url_doc.s3_url_prefix + url_doc.fs_id, stream=True, timeout=1)
r = get(url_doc.s3_url_prefix + url_doc.fs_id, stream=True, timeout=30)

else:
try:
r = get(url_doc.url, stream=True, timeout=1)
r = get(url_doc.url, stream=True, timeout=5)
except ConnectTimeout:
r = get(url_doc.s3_url_prefix + url_doc.fs_id, stream=True, timeout=1)
r = get(url_doc.s3_url_prefix + url_doc.fs_id, stream=True, timeout=30)

if r.status_code != 200:
raise MPRestError(f"Cannot retrieve charge density for {material_id}.")
Expand Down

0 comments on commit a87971f

Please sign in to comment.