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

Add Lambda to requeue undownloaded granules #35

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

chuckwondo
Copy link
Collaborator

What I am changing

I've added the ability to requeue undownloaded granules for download when related download messages may have dropped off the main queue as well as the associated DLQ.

How I did it

I created a new standalone Lambda function that is deployed as part of the stack, but is not connected to any trigger/notification. It is intended solely for manual invocation. It expects 2 input values: (1) a date to use for querying the DB to find granules with an ingestion date matching the given date (but where downloaded=false), and (2) a "dry run" indicator (during a "dry run", undownloaded granules for the specified date are found, but not requeued).

How you can test it

To make it easy to run the Lambda function from the command line (without having to locate the "mangled" function name the CDK generates), you can use the shell script that I included.

When run from the root of the repo, the script will automatically source your .env file, which should include a value for IDENTIFIER (or you can specify directly on the command line). It will locate the correct lambda function from the stack and construct a payload for invocation from the args supplied to the script.

For example (assuming you either have AWS_PROFILE and IDENTIFIER exported or configured in your .env file):

lambdas/requeuer/invoke --dry-run 2023-06-10 response.json

This will find all undownloaded granules with an ingestion date of 2023-06-10 and write the output to response.json. The output will include the inputs (dry run flag and date), along with the URL of the target queue, a count of the granules, and the list of granules (id, filename, and download URL for each).

After inspecting the results of a dry run, you may requeue the granules by rerunning the same command but by replacing the flag --dry-run with --no-dry-run. One of the 2 flags must be specified. In order to reduce the chance of an accident, there is no default, forcing explicitness.

@chuckwondo chuckwondo force-pushed the issue31/manual-requeue-for-download branch from 185b4ec to 5357c56 Compare December 5, 2023 23:06
@sharkinsspatial sharkinsspatial merged commit 5f10f4c into main Dec 6, 2023
@sharkinsspatial sharkinsspatial deleted the issue31/manual-requeue-for-download branch December 6, 2023 16:56
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