Skip to content

Commit

Permalink
Catch ConnectionError in event gather pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacna committed Jan 27, 2022
1 parent 4f8b6c7 commit 128ea0d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cdp_backend/pipeline/event_gather_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from gcsfs import GCSFileSystem
from prefect import Flow, task
from prefect.tasks.control_flow import case, merge
from requests import ConnectionError

from ..database import constants as db_constants
from ..database import functions as db_functions
Expand Down Expand Up @@ -1001,7 +1002,7 @@ def _process_person_ingestion(
db_model=person_picture_db_model,
credentials_file=credentials_file,
)
except (FileNotFoundError, ClientResponseError) as e:
except (FileNotFoundError, ClientResponseError, ConnectionError) as e:
person_picture_db_model = None
log.warning(
f"Person ('{person.name}'), picture URI could not be archived."
Expand All @@ -1021,7 +1022,12 @@ def _process_person_ingestion(
db_model=person_db_model,
credentials_file=credentials_file,
)
except (FieldValidationFailed, RequiredField, InvalidFieldType):
except (
FieldValidationFailed,
RequiredField,
InvalidFieldType,
ConnectionError,
):
log.warning(
f"Person ({person_db_model.to_dict()}), "
f"was missing required information. Generating minimum person details."
Expand Down Expand Up @@ -1069,7 +1075,7 @@ def _process_person_ingestion(
else:
person_seat_image_db_model = None

except (FileNotFoundError, ClientResponseError) as e:
except (FileNotFoundError, ClientResponseError, ConnectionError) as e:
person_seat_image_db_model = None
log.warning(
f"Person ('{person.name}'), seat image URI could not be archived."
Expand Down Expand Up @@ -1441,10 +1447,10 @@ def store_event_processing_results(
db_model=matter_file_db_model,
credentials_file=credentials_file,
)
except FieldValidationFailed:
log.error(
except (FieldValidationFailed, ConnectionError) as e:
log.warning(
f"MatterFile ('{supporting_file.uri}') "
f"could not be archived. Skipping."
f"could not be archived. Skipping. Error: {e}"
)

# Archive as event minutes item file
Expand All @@ -1460,10 +1466,10 @@ def store_event_processing_results(
db_model=event_minutes_item_file_db_model,
credentials_file=credentials_file,
)
except FieldValidationFailed:
except (FieldValidationFailed, ConnectionError) as e:
log.error(
f"EventMinutesItemFile ('{supporting_file.uri}') "
f"could not be archived."
f"could not be archived. Error: {e}"
)

# Add vote information
Expand Down

0 comments on commit 128ea0d

Please sign in to comment.