awslabs / awslabs/amazon-dynamodb-tools
Quicker exit on non-recoverable systemic errors
- Dominant language
- Python
- Stars
- 181
- Forks
- 50
- Avg merge
- 4h 11m
- Merged PRs (30d)
- 36
Description
Right now, if one task gets a fatal error, we're adding it to an `error_accumulator` and then in the driver pulling that error out for display once all executors finish. Really though, once a non-recoverable system-wide fatal error has been hit, it might be nice to let other tasks to know to exit early on startup or ideally in-place for long-running work. There's not a nice way in Spark to do this in-band.
One option is in our S3 bucket (already used for various things including rate limiting) we could have a kill-switch object which tasks can look for to know "oh we're done here" and early exit, thus not wasting time running once a fatal error has been found.
For example, this code inside `fill` should do something after adding the error to the accumulator to not only end this task but cause all other tasks to stop.
except botocore.exceptions.ClientError as e:
if get_error_code(e) == DYNAMO_DB_THROTTLE_EXCEPTION:
print('Persistent throttling on batch_writer exit, give up on last few item inserts...')
elif get_error_code(e) == DYNAMO_DB_VALIDATION_EXCEPTION:
error_accumulator.add([f"Schema validation error: Generated items don't match table schema"])
# Must all tasks hit the same error? It doesn't take long, but it seems messy.
else:
error_accumulator.add([f"Error during writing: {get_error_message(e)}"])
Alternatively, we could output to CW a sentinel string saying effectively "--- Well I'm dead with an exception ---" (exact text TBD) and use our existing code that watches the logs looking for fatal issues to trigger an early job stoppage.
Contributor guide
Research direction
Start by tracing the fill path, the driver’s error_accumulator handling, and the existing log-watching code mentioned in the issue. Compare the proposed S3 kill-switch and CloudWatch sentinel approaches, then clarify how tasks should stop after a non-recoverable system-wide error; done means one fatal error causes other work to exit early without waiting for all executors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, spark
- Domain
- cloud, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100