Skip to content

Added a check flag to extract for logs pending extraction - #107

Merged
CodyCBakerPhD merged 4 commits into
mainfrom
detect-pending-logs
Oct 28, 2026
Merged

CodyCBakerPhD merged 4 commits into
mainfrom
detect-pending-logs

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Carries dandi/s3-log-extraction#320 down to the DANDI plugin. dandis3logextraction extract <s3_root> --mode remote --inventory … --cache … --check reports whether any log files are pending extraction, then exits without extracting.

  • It returns before any extraction setup and stops at the first log file not yet extracted. It writes no records and no temporary directory.
  • It exits 3 when something is pending and 0 when nothing is, matching the upstream flag. 1 stays an error, such as corrupted records, so a script can tell the two apart. One short line is printed either way.
  • It goes through DandiRemoteS3LogAccessExtractor.has_unprocessed_s3_urls. The records files are named after the extractor class (DandiRemoteS3LogAccessExtractor_s3-url-processing-end.txt), so the upstream CLI would read the wrong records for the DANDI cache.
  • An earlier revision added a standalone pending command instead. It was removed without an alias.

This is for the host-side cron check in brain-bbqs-runners/dandi-usage-runner#11, so the daily extraction workflow only runs when there is something to extract.

  • Version bumped to 1.6.2. Changelog and README updated.
  • The upstream pin is raised to s3_log_extraction>=1.14.1, the release that shipped --check and has_unprocessed_s3_urls. The 1.11.11 this PR first pinned was never published.

Upstream 1.14.1 compatibility

1.14.1 also carries the breaking changes of dandi/s3-log-extraction#321. The plugin only reads excluded addresses through config.get_excluded_ips(), which is still public, so nothing here breaks.

One behavior gap is out of scope for this PR. Upstream 1.14.1 now drops excluded IPs at extraction by passing EXCLUDED_IPS to its awk script. The DANDI extractor uses its own _dandi_extraction.awk, which does not read that variable, so DANDI extraction keeps their records. The DANDI summaries still leave them out.

Testing

  • New tests/test_extract_check.py (marked ai_generated) checks output and exit codes against DANDI-named records. It also checks that no temporary directory is left behind and that the records are unchanged.
  • I ran the suite locally against the published s3-log-extraction==1.14.1, with gawk. 123 passed and 1 failed. The failure is test_dandi_summaries.py::test_dandiset_summaries, which needs api.dandiarchive.org, and this container's proxy refuses it (403). pre-commit run --all-files passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_019NGBLufw1kq2iy4LNeWs89

`dandis3logextraction pending <s3_root>` prints the number of remote log
files the DANDI extractor would process, reading the DANDI extractor's
own records. With --exit-code it exits 1 when any are pending. Raises
the upstream pin to s3_log_extraction>=1.11.11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NGBLufw1kq2iy4LNeWs89
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NGBLufw1kq2iy4LNeWs89
@CodyCBakerPhD CodyCBakerPhD self-assigned this Oct 25, 2026

Copy link
Copy Markdown
Collaborator Author

CI on this PR is expected to fail at install time: it requires s3_log_extraction>=1.11.11, which only exists once dandi/s3-log-extraction#320 is merged and released to PyPI. Re-running CI after that release should go green. This is not worked around here.


Generated by Claude Code

`dandis3logextraction extract ... --mode remote --check` returns before
any extraction setup, stops at the first log file not yet extracted,
and exits 3 when some are pending and 0 when none are, matching the
upstream `extract --check`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NGBLufw1kq2iy4LNeWs89
@CodyCBakerPhD CodyCBakerPhD changed the title Added a command to check for remote logs pending extraction Added a check flag to extract for logs pending extraction Oct 28, 2026
The `--check` flag shipped in s3_log_extraction 1.14.1; 1.11.11 was
never published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019NGBLufw1kq2iy4LNeWs89
@CodyCBakerPhD
CodyCBakerPhD marked this pull request as ready for review October 28, 2026 05:18
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.75000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.15%. Comparing base (2e2fd34) to head (9552a48).

Files with missing lines Patch % Lines
..._s3_log_extraction/_command_line_interface/_cli.py 68.75% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #107       +/-   ##
===========================================
+ Coverage   67.05%   85.15%   +18.09%     
===========================================
  Files           4        9        +5     
  Lines         170      660      +490     
===========================================
+ Hits          114      562      +448     
- Misses         56       98       +42     
Flag Coverage Δ
unittests 85.15% <68.75%> (+18.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
..._s3_log_extraction/_command_line_interface/_cli.py 62.30% <68.75%> (-0.86%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CodyCBakerPhD
CodyCBakerPhD merged commit 7c8dd16 into main Oct 28, 2026
7 checks passed
@CodyCBakerPhD
CodyCBakerPhD deleted the detect-pending-logs branch October 28, 2026 05:37
CodyCBakerPhD pushed a commit that referenced this pull request Oct 28, 2026
Brings in the extract --check flag of #107, which already raised the upstream
pin to >=1.14.1. Both changelog entries stay under Upcoming, and the version
stays at 1.7.0, this pull request's single bump above main's 1.6.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LWo8Rh1Ceh8UAWkJCdHou3
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