Skip to content
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

docs(docs): add native versioning #8714

Merged
merged 6 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ metadata-ingestion/generated/**

# docs
docs/generated/
docs-website/versioned_docs/
tmp*
temp/**

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ Please follow the [DataHub Quickstart Guide](https://datahubproject.io/docs/quic

If you're looking to build & modify datahub please take a look at our [Development Guide](https://datahubproject.io/docs/developers).

[![DataHub Demo GIF](docs/imgs/entity.png)](https://demo.datahubproject.io/)
<p align="center">
<a href="https://demo.datahubproject.io/">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/entity.png"/>
</a>
</p>

## Source Code and Repositories

Expand Down
4 changes: 3 additions & 1 deletion datahub-web-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ for functional configurability should reside.
to render a view associated with a particular entity type (user, dataset, etc.).


![entity-registry](./entity-registry.png)
<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/entity-registry.png"/>
</p>

**graphql** - The React App talks to the `dathub-frontend` server using GraphQL. This module is where the *queries* issued
against the server are defined. Once defined, running `yarn run generate` will code-gen TypeScript objects to make invoking
Expand Down
66 changes: 55 additions & 11 deletions docker/airflow/local_airflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,35 +138,75 @@ Successfully added `conn_id`=datahub_rest_default : datahub_rest://:@http://data

Navigate the Airflow UI to find the sample Airflow dag we just brought in

![Find the DAG](../../docs/imgs/airflow/find_the_dag.png)

<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/find_the_dag.png"/>
</p>


By default, Airflow loads all DAG-s in paused status. Unpause the sample DAG to use it.
![Paused DAG](../../docs/imgs/airflow/paused_dag.png)
![Unpaused DAG](../../docs/imgs/airflow/unpaused_dag.png)

<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/paused_dag.png"/>
</p>


<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/unpaused_dag.png"/>
</p>


Then trigger the DAG to run.

![Trigger the DAG](../../docs/imgs/airflow/trigger_dag.png)

<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/trigger_dag.png"/>
</p>


After the DAG runs successfully, go over to your DataHub instance to see the Pipeline and navigate its lineage.

![DataHub Pipeline View](../../docs/imgs/airflow/datahub_pipeline_view.png)

![DataHub Pipeline Entity](../../docs/imgs/airflow/datahub_pipeline_entity.png)
<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/datahub_pipeline_view.png"/>
</p>



<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/datahub_pipeline_entity.png"/>
</p>

![DataHub Task View](../../docs/imgs/airflow/datahub_task_view.png)

![DataHub Lineage View](../../docs/imgs/airflow/datahub_lineage_view.png)

<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/datahub_task_view.png"/>
</p>



<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/datahub_lineage_view.png"/>
</p>


## TroubleShooting

Most issues are related to connectivity between Airflow and DataHub.

Here is how you can debug them.

![Find the Task Log](../../docs/imgs/airflow/finding_failed_log.png)

![Inspect the Log](../../docs/imgs/airflow/connection_error.png)
<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/finding_failed_log.png"/>
</p>



<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/connection_error.png"/>
</p>


In this case, clearly the connection `datahub-rest` has not been registered. Looks like we forgot to register the connection with Airflow!
Let's execute Step 4 to register the datahub connection with Airflow.
Expand All @@ -175,4 +215,8 @@ In case the connection was registered successfully but you are still seeing `Fai

After re-running the DAG, we see success!

![Pipeline Success](../../docs/imgs/airflow/successful_run.png)

<p align="center">
<img width="70%" src="https://raw.githubusercontent.com/datahub-project/static-assets/main/imgs/airflow/successful_run.png"/>
</p>

10 changes: 7 additions & 3 deletions docs-website/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ task yarnGenerate(type: YarnTask, dependsOn: [yarnInstall,
args = ['run', 'generate']
}

task yarnStart(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate]) {
task downloadHistoricalVersion(type: Exec) {
yoonhyejin marked this conversation as resolved.
Show resolved Hide resolved
workingDir '.'
commandLine 'python', 'download_historical_versions.py'
yoonhyejin marked this conversation as resolved.
Show resolved Hide resolved
}

task yarnStart(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate, downloadHistoricalVersion]) {
args = ['run', 'start']
}
task fastReload(type: YarnTask) {
Expand Down Expand Up @@ -105,8 +110,7 @@ task serve(type: YarnTask, dependsOn: [yarnInstall] ) {
}


task yarnBuild(type: YarnTask, dependsOn: [yarnLint, yarnGenerate]) {
inputs.files(projectMdFiles)
task yarnBuild(type: YarnTask, dependsOn: [yarnLint, yarnGenerate, downloadHistoricalVersion]) { inputs.files(projectMdFiles)
yoonhyejin marked this conversation as resolved.
Show resolved Hide resolved
inputs.file("package.json").withPathSensitivity(PathSensitivity.RELATIVE)
inputs.dir("src").withPathSensitivity(PathSensitivity.RELATIVE)
inputs.dir("static").withPathSensitivity(PathSensitivity.RELATIVE)
Expand Down
5 changes: 5 additions & 0 deletions docs-website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ module.exports = {
label: "Roadmap",
position: "right",
},
{
type: 'docsVersionDropdown',
position: 'right',
dropdownActiveClassDisabled: true,
},
{
href: "https://slack.datahubproject.io",
"aria-label": "Slack",
Expand Down
53 changes: 53 additions & 0 deletions docs-website/download_historical_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import os
import tarfile

import requests


def download_file(url, destination):
with requests.get(url, stream=True) as response:
response.raise_for_status()
with open(destination, "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)


def fetch_tar_urls(repo_url, folder_path):
api_url = f"{repo_url}/contents/{folder_path}"
response = requests.get(api_url)
response.raise_for_status()
data = response.json()
tar_urls = [
file["download_url"] for file in data if file["name"].endswith(".tar.gz")
]
print(tar_urls)
return tar_urls


def main():
repo_url = "https://api.github.com/repos/acryldata/static-assets-test"
yoonhyejin marked this conversation as resolved.
Show resolved Hide resolved
folder_path = "versioned_docs"

destination_dir = "versioned_docs"
if not os.path.exists(destination_dir):
os.makedirs(destination_dir)

tar_urls = fetch_tar_urls(repo_url, folder_path)

for url in tar_urls:
filename = os.path.basename(url)
destination_path = os.path.join(destination_dir, filename)

try:
download_file(url, destination_path)
print(f"Downloaded {filename} to {destination_dir}")
with tarfile.open(destination_path, "r:gz") as tar:
tar.extractall()
yoonhyejin marked this conversation as resolved.
Show resolved Hide resolved
os.remove(destination_path)
except requests.exceptions.RequestException as e:
print(f"Error while downloading {filename}: {e}")
continue


if __name__ == "__main__":
main()
Loading
Loading