Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error handling when saving files directly to S3 #3021

Merged
merged 1 commit into from
Sep 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions refinery/data_set_manager/isa_tab_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

from django.core.files import File

from file_store.models import FileStoreItem
import botocore

from file_store.models import FileStoreItem
from .models import (Assay, Attribute, Contact, Design, Factor, Investigation,
Node, Ontology, Protocol, ProtocolReference,
ProtocolReferenceParameter, Publication, Study)
Expand Down Expand Up @@ -1019,7 +1020,8 @@ def run(self, path, isa_archive=None, preisa_archive=None):
file_store_item.datafile.save(
os.path.basename(isa_archive), File(isa_archive_obj)
)
except EnvironmentError as exc:
except (EnvironmentError, botocore.exceptions.ClientError,
botocore.exceptions.ParamValidationError) as exc:
logger.error(
"Failed to save ISA archive '%s' to file store: %s",
isa_archive, exc
Expand All @@ -1035,7 +1037,8 @@ def run(self, path, isa_archive=None, preisa_archive=None):
file_store_item.datafile.save(
os.path.basename(isa_archive), File(preisa_archive_obj)
)
except EnvironmentError as exc:
except (EnvironmentError, botocore.exceptions.ClientError,
botocore.exceptions.ParamValidationError) as exc:
logger.error(
"Failed to save pre ISA archive '%s' to file store: %s",
preisa_archive, exc
Expand Down