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

Schedule creation of geotiff zip files in the background #938

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

abyrd
Copy link
Member

@abyrd abyrd commented Apr 11, 2024

Discussion and observations at #932 (comment).

It may be possible to make creation of single-cutoff geotiffs and grids faster (e.g. using NIO buffers). But for the time being it can take several minutes to produce and archive all the geotiffs for a single large regional analysis. This PR is a working proof of concept to perform this operation in the background. The process of making the zip file has been moved almost verbatim into a Task.withAction(). Usage:

> curl 'http://localhost:7070/api/regional/66179beec42a7657af4fdd2d/all' -v
HTTP/1.1 202 Accepted
"Building ZIP in background."

> curl 'http://localhost:7070/api/regional/66179beec42a7657af4fdd2d/all' -v
HTTP/1.1 202 Accepted
"ZIP is already being prepared in the background."

> curl 'http://localhost:7070/api/regional/66179beec42a7657af4fdd2d/all' -v
HTTP/1.1 200 OK
{"url":"http://localhost:7070/files/results/66179beec42a7657af4fdd2d_ALL.zip","humanName":"TEST_REGIONAL_2_4fdd2d.zip"}

Progress is reported as each file is created:
image

also added some more debug level logging to observe speed
@abyrd abyrd requested a review from ansoncfit April 11, 2024 13:42
@abyrd abyrd marked this pull request as ready for review April 15, 2024 10:57
Copy link
Member

@ansoncfit ansoncfit left a comment

Choose a reason for hiding this comment

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

This looks good, thanks.

For the next release cycle, we expect this to be used as an experimental feature. After that, we may want to add mechanisms to clear entries from filesBeingPrepared if errors occur (user triggers activity cancellation, or some timeout). We could design those mechanisms more generally, to handle other background tasks such as network building.

@abyrd abyrd merged commit 471ffe2 into patches-pre-7.2 Apr 16, 2024
1 check passed
@abyrd abyrd deleted the background-multi-grid branch April 16, 2024 02:00
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.

2 participants