Repository navigation
Fetch reports by queue window, and fetch named projects - #10
Merged
Merged
Conversation
make fetch took the 25 most recent active or withdrawn projects that applied before 1 October 2020. Berkeley Lab dates 10 AG1 projects 1 or 2 October 2020, so the cutoff left out three that have reports: AG1-462, AG1-470 and AG1-483. A project without a report left the sample a report short, a report already on disk was reported as fetched, the same as a new download, and adding a report meant downloading it by hand. - The selection keeps to the AG1 window and earlier ones (pdf_last_window), read from the queue ID, most recent first. - It moves past projects without a report until it has 25, trying at most 50 (pdf_candidates_per_report). - Each project's outcome is printed: downloaded, already downloaded or no report found. - python -m src.fetch_pdfs --ids fetches named projects' reports, and flags any queue ID the panel doesn't hold. - The README's sample facts, embedding estimate and "Adding a report" step follow the new default 25. docs/decisions.md records the choice. make test: 172 passed offline. A live make fetch tried 28 projects: AG1-392A, B and C have no report, and it took the next 25. The embed dry run on them estimates 1,980,104 tokens, $0.0396.
…and-in A network failure or a server error was reported as "no report found", so with PJM's site down the fetch would try 50 projects, each waiting out its timeouts. It now has its own outcome and stops at the first one. - --ids fetches each named project once, the summary no longer counts IDs the panel doesn't hold as tried, and --ids can't be combined with --offline. The window setting is read in upper case. - New tests run the fetch against a stand-in for PJM's site: a report at the second address, a missing report, a web page in place of a PDF, reports already on disk, an unreachable site, a server error and --ids from the command line. They also cover queue IDs that end in a letter. Eleven planted bugs each fail a test. - The docs say 13 of the default 25 are in Berkeley Lab's cost data, not 12. They also say that three of the six active or withdrawn AG1 projects dated October have reports, and that the 1 October dates are Berkeley Lab's. The README's example of adding a report also runs make extract.
# Conflicts: # README.md
…aside - Only a 404 or 410 counts as no report. PJM answered 404 at both addresses for AG1-392A, AG1-392B and AG1-392C. A refusal, a rate limit, a redirect or a server error stops the fetch, with a message that names the status, and the command exits with status 1. - A report is written beside its final name and moved into place once whole, so an interrupted write leaves nothing a later run would skip. - PDF_LAST_WINDOW is read in any case and must name a queue window, such as AG1. - A test checks that projects that applied on the same day are taken in queue ID order. - The README explains queue IDs, and docs/decisions.md gives the 404 rule, its evidence and its trade-off. 189 tests pass offline.
# Conflicts: # docs/decisions.md
The fetch doesn't follow redirects, and a redirect stops it, like a refusal. Nothing said so or tested it. PJM answered 404, without redirecting, for every missing report checked, so this changes nothing in practice.
Owner
Author
|
Evidence for
|
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.
Problem.
make fetchchose reports by a date cutoff, 1 October 2020, which left out AG1 projects that Berkeley Lab dates 1 or 2 October, though some of them have reports. Adding another project's report meant saving it by hand. A report already on disk was reported as fetched. And if PJM's site failed, every project was counted as having no report, so the fetch carried on through each timeout.What changes.
make fetchlooks for reports of projects in the AG1 window or an earlier one (pdf_last_windowinsrc/config.py). It works back from the active or withdrawn projects that applied most recently, skips any without a report, and stops once it has 25. Projects that applied on the same day are taken in order of queue ID.python -m src.fetch_pdfs --ids AF1-236 ...downloads named projects' reports. An ID the panel doesn't hold is reported and not tried.PDF_LAST_WINDOWis read in any case. A value that names no queue window, such asAG 1, is refused when the settings load.docs/decisions.md("Which reports make fetch downloads") and future work follow the new default sample: 22 projects dated 30 September 2020, and AG1-462, 470 and 483, dated 1 October. In Berkeley Lab's data, 12 are 5 MW or smaller. The reports are 12 feasibility studies, 7 system impact studies and 6 that combine the two, and 13 of the projects are in Berkeley Lab's PJM cost data. The README also explains what a queue ID is.Verification.
make test: 202 passed offline, with the currentmainmerged in. New tests run the fetch against a stand-in for PJM's site. Twenty planted bugs, across both review rounds and my final review, each fail a test.make fetchinto an empty folder downloaded the 25 default reports in 77 seconds, byte for byte the same as an earlier download. AG1-392A, B and C have no report.--ids AF1-236 AC2-093 AF2-353 ZZ9-999downloaded the three reports, byte for byte the copies I read by hand, and said ZZ9-999 isn't in the panel. After the review fixes,--ids AG1-462into an empty folder downloaded the same file as before and left no partial file.Review. A separate agent reviewed the first commit.
ac167c3fixes its findings, among them: a failure to reach the site counted as no report,--idscould fetch a project twice, the docs gave 12 projects in Berkeley Lab's cost data rather than 13, and nothing tested the fetch against a stand-in for PJM's site. A second separate review, of this PR, asked for changes, and6b8b193makes them:PDF_LAST_WINDOWis checked.docs/decisions.md, and this description's note for existing checkouts.A third separate review, of
07bc3e3, was stopped before it reported. My own final review of the whole diff found one gap: nothing said or tested what a redirect does. The fetch doesn't follow redirects, and a redirect stops it, like a refusal. PJM answered 404, without redirecting, for every missing report I checked, so this changes nothing in practice; the last commit says so in the code anddocs/decisions.md, and tests it. These last fixes had my review only.Not checked against OpenAI. This PR makes no OpenAI call. Embedding these reports and extracting their costs are paid steps that haven't run.
For existing checkouts. The old default sample included AG1-339, 340 and 341, which the new rule leaves out. Delete them from
data/raw/pdfs/beforemake embed. It takes the first 25 reports by file name that it hasn't embedded yet, so it would otherwise embed them in place of AG1-462, 470 and 483.