503 Service Unavailable due to CMR Payload Too Large

Open
#2,771 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
aws, python
Domain
api, backend

Research direction

Start with apps/api/src/hyp3_api/validation.py, especially _get_cmr_metadata and validate_jobs, which the issue identifies as the CMR error and the source of the oversized query. Check how CMR reports a 413 response and how job validation gathers granules. Done means returning a descriptive error for this case and batching CMR queries to stay under its limit.

Written by the indexing model from the issue text.

Description

bug Jira Bug

Jira: https://asfdaac.atlassian.net/browse/TOOL-3721

Note: The above link is accessible only to members of ASF.


When attempting to submit jobs like:

jobs = sdk.Batch()
for batch in sdk.util.chunk(prepared_jobs):
    jobs += hyp3.submit_prepared_jobs(batch)

I kept getting these errors:

requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://hyp3-jhk-sandbox.asf.alaska.edu/jobs
hyp3_sdk.exceptions.ServiceUnavailableError: <Response [503]> Could not submit jobs due to a CMR error. Please try again later.

However, there was no CMR outage at the time. Looking at the API logs, _get_cmr_metadata is raising this error:

CMR search failed: 413 Client Error: Payload Too Large for url: https://cmr.earthdata.nasa.gov/search/granules.json

Since validate_jobs is gathering all the granules from all the jobs, the payload can exceed the CMR limit.

We should:

  • Return a descriptive error in this case
  • Batch queries to CMR to stay under the limit
Dominant language
Python
Stars
53
Forks
13
Avg merge
1d 2h
Merged PRs (30d)
20

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ASFHyP3/hyp3

All issues in ASFHyP3/hyp3

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.