Skip to content

Commit

Permalink
[dc] Fix AWSIC to record ServerTimeout errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-afedorov committed Sep 12, 2020
1 parent 2844b94 commit 2cf48eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/connectors/aws_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ClientError,
DataNotFoundError,
)
from aiohttp.client_exceptions import ServerTimeoutError
from collections import defaultdict, namedtuple
import csv
from datetime import datetime, timedelta
Expand Down Expand Up @@ -1244,7 +1245,7 @@ async def load_task_response(client, task):
):
yield x

except (ClientError, DataNotFoundError) as e:
except (ClientError, DataNotFoundError, ServerTimeoutError) as e:
log.info(format_exception_only(e))
for x in process_aws_response(task, e):
yield x
Expand Down
5 changes: 5 additions & 0 deletions src/connectors/salesforce_event_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def ingest(table_name, options):
# This will create a single line JSON file containing an array of objects
json.dump(list(reader), f)

if shutil.disk_usage("/").free < 2**30:
# running out of disk space, next run will catch up
break


# Copy all the staged .json files into the landing table
log.info(f'Uploading all files to Snowflake stage: {table_name}.')
db.copy_file_to_table_stage(table_name, os.path.join(temp_dir, '*.json'))
Expand Down

0 comments on commit 2cf48eb

Please sign in to comment.