Repository navigation
Claim burst products before upload so concurrent runs can't mix files - #227
Open
chris-thomas-ga wants to merge 5 commits into
Open
chris-thomas-ga wants to merge 5 commits into
chris-thomas-ga wants to merge 5 commits into
Conversation
Burst products were uploaded in os.walk order and "exists" meant "any .h5 in the prefix", so a job killed mid-upload could leave a partial product that every later run skipped. Upload the .h5 and then the stac-item.json last, and make the existence checks (before processing and before upload) look for the stac-item.json, so a partial upload is re-made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Concurrent runs for the same burst product (e.g. a duplicate delivery of the
same scene, or static layers from two scenes sharing a burst) could pass the
pre-upload existence check together and interleave their file-by-file
uploads, leaving a product mixed from two runs. Before uploading, write a
claim object under {s3_project_folder}/monitoring/upload_claims/ with
If-None-Match, skip the upload if another run holds it, take over claims
older than --upload-claim-stale-after-mins (default 120) with If-Match, and
re-check the commit marker once the claim is held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #226, so please merge that first (this branch includes its commit).
Description
Two runs writing the same burst at the same time can interleave their uploads and leave a folder with the STAC and
.h5from one run and the tifs from the other. This can happen with a duplicate SQS delivery, or with static layers for two scenes that share a burst. Nothing verifies the checksum file, so it would go unnoticed.Before uploading, each run now writes a small claim object under
{project}/monitoring/upload_claims/usingIfNoneMatch="*". If another run holds the claim, the burst is skipped the same way an existing product is. Claims older than--upload-claim-stale-after-mins(default 120) can be taken over withIfMatch, so a run that crashed doesn't block the burst forever. The claim is released once the upload finishes.Jobs will need PutObject, HeadObject and DeleteObject on the claims prefix.
Testing
Tests in
tests/sar_pipeline/test_s3_upload_claim.pyuse botocore's Stubber. They check what we send to S3 and how we handle each response, but not that S3 really enforces the conditions when two writers race. Worth a quick check against a dev bucket before merging.Type of change