feat: Adding filter_cdx and warc_by_cdx commands (EOT changes)#54
Open
malteos wants to merge 83 commits into
Open
feat: Adding filter_cdx and warc_by_cdx commands (EOT changes)#54malteos wants to merge 83 commits into
malteos wants to merge 83 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
- Coverage 97.24% 96.75% -0.49%
==========================================
Files 9 22 +13
Lines 943 1728 +785
==========================================
+ Hits 917 1672 +755
- Misses 26 56 +30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # cdx_toolkit/cli.py # cdx_toolkit/commoncrawl.py # cdx_toolkit/settings.py # cdx_toolkit/utils.py # cdx_toolkit/warc.py # examples/iter-and-warc.py # tests/conftest.py
…d, query logging + cancel) - Add --crawl partition pruning, raw --athena-query/--athena-query-file (two-tier) - Cost-confirmation prompt before unpartitioned/large scans (--confirm-athena-cost) - Fix SQL injection via escape_sql_literal; robust join_warc_url - Log the executed SQL; cancel the query server-side on Ctrl-C/timeout - Split athena_job_generator into testable units + unit tests
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.
The PR adds two new commands to the CLI:
filter_cdx: Filter CDX files based on a given URL or SURT white list.warc_by_cdx: Fetch WARC files likewarcbut instead of filtering based on a single URL this commands filters based on a given CDX file.Both commands support reading and writing to local or remote paths (like S3) and gzip compression. To make the code more readable, parts of
cli.pywere moved toutils.py.Example usage
Filter CDX files from S3 based on URL or SURT whitelist (input and output paths can be local or remote, e.g., S3):
Fetch WARC records based on filtered CDX (output is written to a local dir or S3)
For better throughput for S3 read/write, we have also a specific implementation using
aioboto3that you can enable with the--implementation=aioboto3argument:To maintain the filter inputs, e.g., the whitelist list, we can add one or multiple files with metadata as resource records to the extracted WARC. To do this, you need to provide the corresponding file paths as arguments
--write-paths-as-resource-records=s3://commoncrawl-dev/eot-archive/malte-test/ccf-gov-federal-web-graph-2024-jun-jul-aug.txtand--write-paths-as-resource-records-metadata=path/to/metadata.json. The metadata file is optional and can have the following optional fields:This in one example for a metadata JSON file:
{ "uri": "filter_cdx.cdx.gz", "warc_content_type": "application/cdx", }The full WARC extraction command would look like this:
TODOs