-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use DbtProject in hooli_data_eng (#78)
expected changes to hooli data eng to move from DbtArtifacts to DbtProject and use the new state handling features --------- Co-authored-by: Christian Minich <[email protected]>
- Loading branch information
1 parent
617a990
commit e55b651
Showing
9 changed files
with
89 additions
and
114 deletions.
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ jobs: | |
steps: | ||
- name: Pre-run checks | ||
id: prerun | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
@@ -36,14 +36,14 @@ jobs: | |
- name: Validate configuration | ||
id: ci-validate | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci check --project-dir ${{ env.DAGSTER_PROJECT_DIR }} --dagster-cloud-yaml-path ${{ env.DAGSTER_CLOUD_YAML_PATH }}" | ||
|
||
- name: Initialize build session | ||
id: ci-init | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
project_dir: ${{ env.DAGSTER_PROJECT_DIR }} | ||
dagster_cloud_yaml_path: ${{ env.DAGSTER_CLOUD_YAML_PATH }} | ||
|
@@ -66,28 +66,14 @@ jobs: | |
if: ${{ steps.prerun.outputs.result != 'skip' }} | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
# Copy the production manifest.json to local directory - Raise error if not retrieved | ||
- name: Download dbt manifest from S3 | ||
if: steps.prerun.outputs.result != 'skip' && github.event_name == 'pull_request' | ||
continue-on-error: true | ||
run: | | ||
output=$(aws s3 cp s3://hooli-demo/dbt_slim_ci/manifest.json ./dbt_project/target/slim_ci/manifest.json 2>&1) || echo "Error: $output" | ||
# Build 'data-eng-pipeline' code location | ||
- name: Build dbt manifest for data-eng-pipeline | ||
- name: Prepare dbt project | ||
if: steps.prerun.outputs.result != 'skip' | ||
run: | | ||
pip install pyopenssl --upgrade; | ||
pip install click --upgrade; | ||
pip install dbt-core dbt-duckdb dbt-snowflake; | ||
pip install pip --upgrade; | ||
pip install dagster-dbt dagster-cloud dbt-core dbt-duckdb dbt-snowflake --upgrade --upgrade-strategy eager; | ||
make deps | ||
make manifest | ||
# Copy production manifest.json to S3 on merge | ||
- name: Upload dbt manifest to S3 | ||
if: steps.prerun.outputs.result != 'skip' && github.event_name != 'pull_request' | ||
run: | | ||
aws s3 cp ./dbt_project/target/manifest.json s3://hooli-demo/dbt_slim_ci/manifest.json | ||
dagster-dbt project prepare-for-deployment --file hooli_data_eng/project.py | ||
dagster-cloud ci dagster-dbt project manage-state --file hooli_data_eng/project.py | ||
- name: Build and upload Docker image for data-eng-pipeline | ||
if: steps.prerun.outputs.result != 'skip' | ||
|
@@ -100,7 +86,7 @@ jobs: | |
- name: Update build session with image tag for data-eng-pipeline | ||
id: ci-set-build-output-data-eng-pipeline | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci set-build-output --location-name=data-eng-pipeline --image-tag=$IMAGE_TAG-data-eng-pipeline" | ||
|
||
|
@@ -116,7 +102,7 @@ jobs: | |
- name: Update build session with image tag for basics | ||
id: ci-set-build-output-basics | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci set-build-output --location-name=basics --image-tag=$IMAGE_TAG-basics" | ||
|
||
|
@@ -132,7 +118,7 @@ jobs: | |
- name: Update build session with image tag for batch enrichment | ||
id: ci-set-build-output-batch-enrichment | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci set-build-output --location-name=batch_enrichment --image-tag=$IMAGE_TAG-batch-enrichment" | ||
|
||
|
@@ -148,7 +134,7 @@ jobs: | |
- name: Update build session with image tag for snowflake insights | ||
id: ci-set-build-output-snowflake-insights | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci set-build-output --location-name=snowflake_insights --image-tag=$IMAGE_TAG-snowflake-insights" | ||
|
||
|
@@ -164,7 +150,7 @@ jobs: | |
- name: Update build session with image tag for demo_assets | ||
id: ci-set-build-output-demo-assets | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci set-build-output --location-name=demo_assets --image-tag=$IMAGE_TAG-demo-assets" | ||
|
||
|
@@ -181,7 +167,7 @@ jobs: | |
- name: Deploy to Dagster Cloud | ||
id: ci-deploy | ||
if: steps.prerun.outputs.result != 'skip' | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci deploy" | ||
|
||
|
@@ -207,13 +193,13 @@ jobs: | |
- name: Update PR comment for branch deployments | ||
id: ci-notify | ||
if: steps.prerun.outputs.result != 'skip' && always() | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci notify --project-dir=${{ env.DAGSTER_PROJECT_DIR }}" | ||
|
||
- name: Generate summary | ||
id: ci-summary | ||
if: steps.prerun.outputs.result != 'skip' && always() | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].27 | ||
uses: dagster-io/dagster-cloud-action/actions/utils/[email protected].38 | ||
with: | ||
command: "ci status --output-format=markdown >> $GITHUB_STEP_SUMMARY" |
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 @@ | ||
.user.yml |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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,20 @@ | ||
import os | ||
from dagster_dbt import DbtProject | ||
from dagster._utils import file_relative_path | ||
|
||
|
||
def get_env(): | ||
if os.getenv("DAGSTER_CLOUD_IS_BRANCH_DEPLOYMENT", "") == "1": | ||
return "BRANCH" | ||
if os.getenv("DAGSTER_CLOUD_DEPLOYMENT_NAME", "") == "data-eng-prod": | ||
return "PROD" | ||
return "LOCAL" | ||
|
||
|
||
DBT_PROJECT_DIR = file_relative_path(__file__, "../dbt_project") | ||
|
||
dbt_project = DbtProject( | ||
project_dir=DBT_PROJECT_DIR, | ||
state_path="target/slim_ci", | ||
target=get_env(), | ||
) |
Oops, something went wrong.