-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document the command line app. #51
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# Using the Toolkit with spark-submit | ||
|
||
The Toolkit offers a variety of extraction jobs with | ||
[`spark-submit`](https://spark.apache.org/docs/latest/submitting-applications.html) | ||
. These extraction jobs have a few configuration options, and analysis can use | ||
RDD or DataFrame is most cases. | ||
|
||
The extraction jobs have a basic outline of: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLinAppRunner PATH_TO_AUT_JAR --extractor EXTRACTOR --input INPUT DIRECTORY --output OUTPUT DIRECTORY | ||
``` | ||
|
||
Additional flags include: | ||
|
||
* `--output-format FORMAT` (Used only for the `DomainGraphExtractor`, and the | ||
options are `TEXT` (default) or `GEXF`.) | ||
* `--df` (The extractor will use a DataFrame to carry out analysis.) | ||
* `--split` (The extractor will put results for each input file in its own | ||
directory. Each directory name will be the name of the ARC/WARC file parsed.) | ||
* `--partition N` (The extractor will partition RDD or DataFrame according to N | ||
before writing results. The is useful to combine all the results to a single | ||
file.) | ||
|
||
## Domain Frequency | ||
|
||
This extractor outputs a directory of CSV files or a single CSV file with the | ||
following columns: `domain`, and `count`. | ||
|
||
### RDD | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor DomainFrequencyExtractor --input /path/to/warcs/* --output output/path | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor DomainFrequencyExtractor --input /path/to/warcs/* --output output/path --partition 1 | ||
``` | ||
|
||
### DataFrame | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor DomainFrequencyExtractor --input /path/to/warcs/* --output output/path --df | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor DomainFrequencyExtractor --input /path/to/warcs/* --output output/path --df --partition 1 | ||
``` | ||
|
||
## Domain Graph | ||
|
||
This extractor outputs a directory of CSV files or a single CSV file with the | ||
following columns: `crawl_date`, `src_domain`, `dest_domain`, and `count`. | ||
|
||
### RDD | ||
|
||
**Note**: The RDD output is formatted slightly different. The first three | ||
columns are an array: | ||
`((CrawlDate, SourceDomain, DestinationDomain), Frequency)` | ||
|
||
### DataFrame | ||
|
||
Directory of CSV files: | ||
ruebot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df --partition 1 | ||
``` | ||
|
||
## Image Graph | ||
|
||
This extractor outputs a directory of CSV files or a single CSV file with the | ||
following columns: `crawl_date`, `src`, `image_url`, and `alt_text`. | ||
|
||
**Note**: This extractor will only work with the DataFrame option. | ||
|
||
### DataFrame | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df | ||
``` | ||
|
||
A single CSV file: | ||
|
||
``` shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df --partition 1 | ||
``` | ||
|
||
## Plain Text | ||
|
||
This extractor outputs a directory of CSV files or a single CSV file with the | ||
following columns: `crawl_date`, `domain`, `url`, and `text`. | ||
|
||
### RDD | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor PlainTextExtractor --input /path/to/warcs/* --output output/path | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor PlainTextExtractor --input /path/to/warcs/* --output output/path --partition 1 | ||
``` | ||
|
||
### DataFrame | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor ImageGraphExtractor --input /path/to/warcs/* --output output/path --df --partition 1 | ||
``` | ||
|
||
## Web Pages | ||
|
||
This extractor outputs a directory of CSV files or a single CSV file with the | ||
following columns: `crawl_date`, `url`, `mime_type_web_server`, | ||
`mime_type_tika`, `language`, and `content`. | ||
|
||
**Note**: This extractor will only work with the DataFrame option. | ||
|
||
### DataFrame | ||
|
||
Directory of CSV files: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor WebPagesExtractor --input /path/to/warcs/* --output output/path --df | ||
``` | ||
|
||
A single CSV file: | ||
|
||
```shell | ||
spark-submit --class io.archivesunleashed.app.CommandLineAppRunner path/to/aut-fatjar.jar --extractor WebPagesExtractor --input /path/to/warcs/* --output output/path --df --partition 1 | ||
``` |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these configuration options need to be used with a specific launch of the toolkit (e.g. package, uberjar, etc.)? At first glance, I guess I'm a little unsure of where to start or in terms of workflow, when this script would be introduced (e.g. use within or outside of sparkshell?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a link to this https://spark.apache.org/docs/latest/submitting-applications.html