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

Save intermediate COG files to S3 #563

Merged
merged 5 commits into from
Aug 1, 2024
Merged

Save intermediate COG files to S3 #563

merged 5 commits into from
Aug 1, 2024

Conversation

jterry64
Copy link
Member

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Check the commit's or even all commits' message styles matches our requested structure.
  • Check your code additions will fail neither code linting checks nor unit test.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Save intermediate files for COGs locally, with the incorrect expectations the /tmp folder persists between spot instance retries.

Issue Number: GTC-2908

What is the new behavior?

  • Save intermediate files to S3 so on spot retries, we can download already completed steps
  • Save overviews externally using -ro option so we can also save them to S3, and only save them once they complete
  • Delete intermediate files once the final COG is uploaded

Does this introduce a breaking change?

  • Yes
  • No

Other information

@jterry64 jterry64 changed the base branch from master to develop July 26, 2024 21:50
Copy link
Contributor

@danscales danscales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, assuming you get the tests working. Thanks for looking into this!


ME=$(basename "$0")
. get_arguments.sh "$@"
#. get_arguments.sh "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about why you commented this out. Doesn't this break the argument parsing? Did you just do this temporarily for some testing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this commented out line is the reason your tests are failing (in test_cog_asset

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, good catch, that was to test running it locally

if [ ! -f "cog.tif" ]; then
gdal_translate merged.tif cog.tif -of COG -co COMPRESS=DEFLATE -co BLOCKSIZE="${BLOCK_SIZE}" -co BIGTIFF=IF_SAFER -co NUM_THREADS=ALL_CPUS --config GDAL_CACHEMAX 70% --config GDAL_NUM_THREADS ALL_CPUS
fi
gdal_translate merged.tif cog.tif -of COG -co COMPRESS=DEFLATE -co BLOCKSIZE="${BLOCK_SIZE}" -co BIGTIFF=IF_SAFER -co NUM_THREADS=ALL_CPUS -co OVERVIEWS=FORCE_USE_EXISTING --config GDAL_CACHEMAX 70% --config GDAL_NUM_THREADS ALL_CPUS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just wondering - so I assume that the OVERVIEWS=FORCE_USE_EXISTING is the option that makes sure that merged.tif.ovr is used, even though it is not explicitly named on the command line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, that confused me too, but there's no option to specify an overview file, you just need to follow the naming convention.

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.92%. Comparing base (fb6fad9) to head (45a91c4).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #563   +/-   ##
========================================
  Coverage    81.92%   81.92%           
========================================
  Files          126      126           
  Lines         5692     5693    +1     
========================================
+ Hits          4663     4664    +1     
  Misses        1029     1029           
Flag Coverage Δ
unittests 81.92% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@dmannarino dmannarino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@jterry64 jterry64 merged commit bfe8534 into develop Aug 1, 2024
2 checks passed
@jterry64 jterry64 deleted the gtc-2908/save_cog_s3 branch August 1, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants