Skip to content

Default hourly() to poll_interval=1 and forward additional_kw to retrieve - #12

Open
aklocker42 wants to merge 2 commits into
mainfrom
akl/hourly-poll-interval-default
Open

aklocker42 wants to merge 2 commits into
mainfrom
akl/hourly-poll-interval-default

Conversation

@aklocker42

@aklocker42 aklocker42 commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • hourly, monthly and yearly accepted additional_kw... but never forwarded it to retrieve, so poll_interval, max_wait and verbose could not be overridden. It is now forwarded.
  • hourly() gets an explicit poll_interval=1 keyword (documented). This matches CDSAPI.jl, which polls every 1 s.
  • monthly() and yearly() get an explicit poll_interval=10 keyword (documented), so their default is visible in the signature. This is unchanged, untested legacy behavior, not a size-based argument — we only benchmarked single-variable hourly() requests (table below); monthly()/yearly() at poll_interval=1 may well perform just as well, we just haven't measured it. Remaining kwargs (max_wait, verbose) are forwarded to retrieve.

Why

Relates to #4 (CDSAPI.jl vs this package). Hourly requests are small and usually finish within a minute. retrieve backs off from 1 s up to poll_interval, so with the old ceiling of 10 the client could sit on a finished job for several seconds before noticing.

Paired timings against CDSAPI.jl are dominated by CDS queue time, with the same request ranging from 13.9 s to 101.9 s. The effect is real but hard to see statistically:

Comparison (single-variable hourly requests) Result
Earlier 12-pair run at 1 s polling, this package vs CDSAPI.jl mean 40.4 s vs 47.2 s, this package faster in 7 of 12 pairs
6-pair run, poll_interval=10 vs 1 mean 50.7 s vs 47.7 s, 3 wins each

The earlier runs at the old default of 10 were slower than CDSAPI.jl: 40.6 s vs 23.2 s and 48.9 s vs 23.2 s.

Tests

  • New offline test "poll_interval plumbing" stubs retrieve and checks the defaults and overrides reach it for hourly (1), monthly (10) and yearly (10).
  • The stub redefines retrieve inside the module, so that testset has to stay last in runtests.jl.
  • Pkg.test(): 36 of 36 pass, including the live ERA5 download test.

🤖 Generated with Claude Code

…ieve

hourly/monthly/yearly accepted `additional_kw...` but never forwarded it, so
poll_interval, max_wait and verbose could not be overridden. Forward it, and
default hourly() to poll_interval=1 (matching CDSAPI.jl's 1 s polling) since
hourly requests are small; monthly/yearly keep 10.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread src/CopernicusClimateDataStore.jl Outdated
max_wait = 3600,
poll_interval = 10,
verbose = true)
merge((; max_wait = 3600, poll_interval = 10, verbose = true), additional_kw)...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this says poll_interval=10. Does that mean that the new poll interval being passed in is not respected? not sure I understand

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The 10 was only a default: it was merged under additional_kw, so a caller's poll_interval did override it. That was hard to see, so in a905053 it's now an explicit poll_interval=10 keyword on monthly and yearly, forwarded to retrieve, the same way hourly does it. The existing plumbing test covers both the default and the override.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why would we have a different poll interval for hourly vs monthly/yearly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok the description above says something

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

retrieve backs off from 1 s toward the poll_interval ceiling. hourly requests are single-variable and usually finish within about a minute, so with the old ceiling of 10 the client could sit on an already-finished job for several seconds before the next poll — lowering the ceiling to 1 catches completion sooner, at the cost of a few extra HTTP status checks.

monthly/yearly requests bundle a full month/year of hourly data in one CDS job, so they queue and process for much longer. Polling every 1 s there would only add HTTP calls while the job is still running, without shortening the wait meaningfully — so I kept the 10 s ceiling. That's what "shorter interval only adds status calls" meant in the PR description; I reworded it there, it wasn't clear.

Comment thread src/CopernicusClimateDataStore.jl Outdated
Replaces the `merge(...)` of defaults with `additional_kw` by a
`poll_interval = 10` keyword forwarded to `retrieve`, matching `hourly`,
and fixes the continuation-line alignment of the `retrieve` calls.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@glwagner

Copy link
Copy Markdown
Member

Their jobs are long, so a shorter interval only adds status calls.

@aklocker42 what does this mean?

@aklocker42

Copy link
Copy Markdown
Collaborator Author

retrieve backs off from 1 s toward the poll_interval ceiling. hourly requests are single-variable and usually finish within about a minute, so with the old ceiling of 10 the client could sit on an already-finished job for several seconds before the next poll — lowering the ceiling to 1 catches completion sooner, at the cost of a few extra HTTP status checks.

monthly/yearly requests bundle a full month/year of hourly data in one CDS job, so they queue and process for much longer. Polling every 1 s there would only add HTTP calls while the job is still running, without shortening the wait meaningfully — so I kept the 10 s ceiling. That's what "shorter interval only adds status calls" meant in the PR description; I reworded it there, it wasn't clear.

@glwagner

Copy link
Copy Markdown
Member

I still don't understand. Isn't the total size of the fetched data determined by both the bbox and the time interval? The time interval alone does not determine the size of data fetched.

@aklocker42

Copy link
Copy Markdown
Collaborator Author

You're right, that was imprecise — bbox affects data volume too, and hourly/monthly/yearly all accept an optional area bbox, so it's not a size argument. The actual reason for the different defaults: our benchmarking only tested single-variable hourly requests (1 s vs 10 s polling, table above). We never benchmarked monthly/yearly at 1 s, so poll_interval=10 there is just the untested legacy default, not a principled claim. Updating the PR description to drop that line.

This branch has not been deployed

No deployments
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