fix: configure HTTP connection pools and surface CDA batch errors - #312
Merged
Merged
Conversation
Enovotny
approved these changes
Sep 22, 2026
|
krowvin
added a commit
to HydrologicEngineeringCenter/cwms-cli
that referenced
this pull request
Sep 28, 2026
A time-series copy can report failed stores and still exit 0, causing AWS Batch to mark the job successful. Raise a ClickException with the original error as its cause instead of printing the error and continuing to the completion message. Existing fatal-service error handling remains intact. Observed during September 28, 2026 MVP Batch Events testing: a load into dev used an unencrypted internal HTTP CDA_API_ROOT, matched 147 series, and reported three failed stores, but Batch received exit code 0. The HTTP connection-pool warning is addressed separately in [cwms-python #312](HydrologicEngineeringCenter/cwms-python#312); this companion change fixes the CLI process status. Validation: 38 related loader and CLI error-handling tests passed on Python 3.14. Regression cases demonstrate that both read and aggregate write failures previously exited 0 and now exit 1 while retaining the failure text. Successful, empty-data, and dry-run commands still exit 0. Black, isort, and git diff --check passed. No patched Batch run or live CDA writes were performed; the dev container was unavailable locally.
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.

Internal HTTP CDA loads use Requests' default pool of 10 because cwms-python previously mounted its configured adapter only on HTTPS. Multi-series operations can exceed that pool, producing repeated connection-discard warnings. This PR applies the configured pool and retry policy to both protocols and surfaces request/batch failures with their original diagnostic details.
init_session(). Both use the default pool size of 100 or the caller'spool_connectionsvalue.BatchError(aRuntimeErrorsubclass) for failed concurrent reads/writes, retaining every original exception infailures. Propagate extent lookup failures and invalid JSON; restrict chunk retries to transient failures. Successful writes are not rolled back.Batch script evidence
During September 28, 2026 MVP CWMS Batch Events testing of a CLI time-series load into dev, the job's
CDA_API_ROOTwas confirmed to use an unencrypted internal HTTP URL, structurally:The hostname above is a placeholder. Configuring only the HTTPS adapter leaves this HTTP destination on Requests' default pool. The existing Batch run matched 147 time series and logged repeated
Connection pool is full ... Connection pool size: 10warnings during concurrent stores.The run also reported three failed stores with HTTP 404 database responses and empty error details. These are separate request failures: the pool warning concerns connection reuse and does not itself indicate discarded response data. Preserving the response cannot reconstruct server internals that CDA did not return.
Batch marked the run successful with exit code 0 because cwms-cli caught the aggregate store exception and only printed it. That process-exit behavior is addressed in cwms-cli #279; the library must raise exceptions rather than terminate its caller.
Validation
git diff --checkpassed.Related: #277, #287, and #310. Callers now receive errors where incomplete results or fallback text were previously returned; existing RuntimeError handlers still catch batch failures. HTTP now uses the same retry policy already configured for HTTPS.