-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add documentation on testing BigQuery from ingestion-beam #543
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0fc5170
Create documentation on testing BigQuery from ingestion-beam.
acmiyaguchi 6614dfc
Add a mermaid config file to the docs directory for overflow
acmiyaguchi 6a17c2f
Fix spelling mistakes
acmiyaguchi 77a776d
Move mermaid config to top-level .mermaid
acmiyaguchi 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"themeCSS": ".label foreignObject { overflow: visible; }" | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,27 @@ | ||
graph TD | ||
|
||
subgraph dataops/sandbox/my-project | ||
dataflow | ||
bigquery | ||
pubsub | ||
subscription | ||
|
||
pubsub --> |gcloud pubsub subscriptions| subscription | ||
subscription --> dataflow | ||
dataflow --> bigquery | ||
end | ||
|
||
subgraph mozilla-pipeline-schemas | ||
mps[repository archive] | ||
end | ||
|
||
subgraph ingestion-beam | ||
src[src/] | ||
schemas[schemas.tar.gz] | ||
bq-schemas[bq-schemas/] | ||
|
||
src --> |mvn compile| dataflow | ||
mps --> |download-schemas| schemas | ||
schemas --> |generate-bq-schemas| bq-schemas | ||
bq-schemas --> |update-bq-table| bigquery | ||
end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,85 @@ | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
|
||
|
||
- [Ingestion Testing Workflow](#ingestion-testing-workflow) | ||
- [Setting up the GCS project](#setting-up-the-gcs-project) | ||
- [Bootstrapping schemas from `mozilla-pipeline-schemas`](#bootstrapping-schemas-from-mozilla-pipeline-schemas) | ||
- [Building the project](#building-the-project) | ||
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
# Ingestion Testing Workflow | ||
|
||
The ingestion-beam handles data flow of documents from the edge into various | ||
sinks. You may be interested in standing up a small testing instance to validate | ||
the integration of the various components. | ||
|
||
![diagrams/workflow.mmd](diagrams/workflow.svg) | ||
__Figure__: _An overview of the various components necessary to query BigQuery | ||
against data from a PubSub subscription._ | ||
|
||
## Setting up the GCS project | ||
|
||
Read through [`whd/gcp-quickstart`](https://github.com/whd/gcp-quickstart) for details | ||
about the sandbox environment that is provided by data operations. | ||
|
||
* Install the [Google Cloud SDK](https://cloud.google.com/sdk/) | ||
* Navigate to the [Google Cloud Console](https://cloud.google.com/sdk/) | ||
* Create a new project under `firefox.gcp.mozilla.com/dataops/sandbox` | ||
- `gcloud config set project <PROJECT>` | ||
* Create a PubSub subscription (see `gcp-quickstart/pubsub.sh`) | ||
* Create a GCS bucket | ||
- `gsutil mb gs://<PROJECT>` | ||
* Enable the [Dataflow API](https://console.cloud.google.com/marketplace/details/google/dataflow.googleapis.com) | ||
* Create a service account and store the key locally | ||
|
||
|
||
## Bootstrapping schemas from `mozilla-pipeline-schemas` | ||
|
||
* Download the latest schemas from `mozilla-pipeline-schemas` using `bin/download-schemas`. | ||
- This script may also inject testing resources into the resulting archive. | ||
- A `schemas.tar.gz` will appear at the project root. | ||
* Generate BigQuery schemas using `bin/generate-bq-schemas`. | ||
- Schemas will be written to `bq-schemas/`. | ||
``` | ||
bq-schemas/ | ||
├── activity-stream.impression-stats.1.bigquery.json | ||
├── coverage.coverage.1.bigquery.json | ||
├── edge-validator.error-report.1.bigquery.json | ||
├── eng-workflow.bmobugs.1.bigquery.json | ||
.... | ||
``` | ||
* Update the BigQuery table in the current project using `bin/update-bq-table`. | ||
- This may take several minutes. Read the script for usage information. | ||
* Verify that tables have been updated by viewing the BigQuery console. | ||
|
||
|
||
## Building the project | ||
|
||
Follow the instructions of the project readme. Here is a quick-reference for a running a job from a set of files in GCS. | ||
|
||
```bash | ||
export GOOGLE_APPLICATION_CREDENTIALS=keys.json | ||
PROJECT=$(gcloud config get-value project) | ||
BUCKET="gs://$PROJECT" | ||
|
||
path="$BUCKET/data/*.ndjson" | ||
mvn compile exec:java -Dexec.args="\ | ||
--runner=Dataflow \ | ||
--project=$PROJECT \ | ||
--autoscalingAlgorithm=NONE \ | ||
--workerMachineType=n1-standard-1 \ | ||
--numWorkers=1 \ | ||
--gcpTempLocation=$BUCKET/tmp \ | ||
--inputFileFormat=json \ | ||
--inputType=file \ | ||
--input=$path\ | ||
--outputType=bigquery \ | ||
--output=$PROJECT:\${document_namespace}.\${document_type}_v\${document_version} \ | ||
--bqWriteMethod=file_loads \ | ||
--tempLocation=$BUCKET/temp/bq-loads \ | ||
--errorOutputType=file \ | ||
--errorOutput=$BUCKET/error/ \ | ||
" | ||
``` |
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
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.
Is it possible to decrease the font sizes? This is rendering strangely for me where most of the text looks clipped inside the boxes:
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.
It looks like this will fix it -- mermaid-js/mermaid#790 (comment)
The online editor does the right thing. I think the mermaid cli tool and the online tool are out of sync.
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.
It looks better for me now too.