Skip to content

Commit

Permalink
add blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Apr 18, 2024
1 parent e80ded8 commit 48b32b2
Show file tree
Hide file tree
Showing 20 changed files with 215 additions and 53 deletions.
2 changes: 1 addition & 1 deletion blueprints/108.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace: blueprint
tasks:
- id: extract
type: io.kestra.plugin.fs.http.Download
uri: https://raw.githubusercontent.com/kestra-io/examples/main/datasets/orders.csv
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: transform
type: io.kestra.plugin.jdbc.duckdb.Query
Expand Down
12 changes: 6 additions & 6 deletions blueprints/111.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
id: dbtGitDockerDuckDB
id: dbt_motherduck
namespace: blueprint

tasks:
- id: dbt
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: cloneRepository
- id: clone_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: dbt-build
Expand All @@ -16,12 +16,12 @@ tasks:
docker:
image: ghcr.io/kestra-io/dbt-duckdb:latest
profiles: |
jaffle_shop:
my_dbt_project:
outputs:
dev:
type: duckdb
disable_transactions: true
path: md:jaffle_shop?motherduck_token={{secret('MOTHERDUCK_TOKEN')}}
path: md:my_dbt_project?motherduck_token={{secret('MOTHERDUCK_TOKEN')}}
fixed_retries: 1
threads: 16
timeout_seconds: 300
Expand Down
16 changes: 16 additions & 0 deletions blueprints/212.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
id: docker_example
namespace: blueprints

tasks:
- id: download
type: io.kestra.plugin.fs.http.Download
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: docker
type: io.kestra.plugin.scripts.shell.Commands
inputFiles:
data.csv: "{{ outputs.download.uri }}"
docker:
image: ubuntu:latest
commands:
- tail -n +2 data.csv | wc -l
39 changes: 39 additions & 0 deletions blueprints/213.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
id: hubspot_to_bigquery
namespace: blueprints

tasks:
- id: sync
type: io.kestra.plugin.cloudquery.Sync
inputFiles:
sa.json: "{{ secret('GCP_SERVICE_ACCOUNT') }}"
env:
HUBSPOT_APP_TOKEN: "{{ secret('HUBSPOT_API_TOKEN') }}"
GOOGLE_APPLICATION_CREDENTIALS: sa.json
configs:
- kind: destination
spec:
name: bigquery
path: cloudquery/bigquery
registry: cloudquery
version: "v3.3.16"
write_mode: "append"
spec:
project_id: kestra-prd
dataset_id: hubspot
- kind: source
spec:
name: hubspot
path: cloudquery/hubspot
registry: cloudquery
version: "v3.0.18"
destinations:
- "bigquery"
tables:
- "*"
spec:
max_requests_per_second: 5

triggers:
- id: schedule
type: io.kestra.core.models.triggers.types.Schedule
cron: 0 6 * * *
30 changes: 30 additions & 0 deletions blueprints/214.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
id: sqlmesh
namespace: blueprint
description: Clone SQLMesh project and run the project, and query with DuckDB
tasks:

- id: working_dir
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: git_clone
type: io.kestra.plugin.git.Clone
url: https://github.com/TobikoData/sqlmesh-examples.git
branch: main

- id: sqlmesh
type: io.kestra.plugin.sqlmesh.cli.SQLMeshCLI
beforeCommands:
- cd 001_sushi/1_simple
commands:
- sqlmesh plan --auto-apply
outputFiles:
- '001_sushi/1_simple/db/sushi-example.db'
- id: query
type: io.kestra.plugin.jdbc.duckdb.Query
inputFiles:
data.db: "{{ outputs.sqlmesh.outputFiles['001_sushi/1_simple/db/sushi-example.db']
}}"
sql: |
ATTACH '{{workingDir }}/data.db';
SELECT * FROM sushisimple.top_waiters;
store: true
37 changes: 37 additions & 0 deletions blueprints/215.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
id: orchestrate_everything
namespace: blueprints

inputs:
- id: use_case
description: What do you want to orchestrate?
type: ENUM
defaults: Data pipelines
values:
- Data pipelines
- Microservices
- Business processes
- Marketing automation
tasks:
- id: conditional_branching
type: io.kestra.core.tasks.flows.Switch
value: "{{ inputs.use_case }}"
cases:
Data pipelines:
- id: data_pipelines
type: io.kestra.core.tasks.log.Log
message: Managing important data products

Microservices:
- id: microservices
type: io.kestra.core.tasks.log.Log
message: Orchestrating critical applications

Business processes:
- id: business_processes
type: io.kestra.core.tasks.log.Log
message: Orchestrating critical applications

Marketing automation:
- id: marketing_automation
type: io.kestra.core.tasks.log.Log
message: Orchestrating critical applications
37 changes: 37 additions & 0 deletions blueprints/216.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
id: http_check
namespace: dev

inputs:
- id: uri
type: URI
defaults: https://kestra.io

tasks:
- id: api
type: io.kestra.plugin.fs.http.Request
uri: "{{ inputs.uri }}"

- id: check_status
type: io.kestra.core.tasks.flows.If
condition: "{{ outputs.api.code != 200 }}"
then:
- id: unhealthy
type: io.kestra.core.tasks.log.Log
message: Server unhealthy!!! Response {{ outputs.api.body }}
- id: send_slack_alert
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"channel": "#alerts",
"text": "The server {{ inputs.uri }} is down!"
}
else:
- id: healthy
type: io.kestra.core.tasks.log.Log
message: Everything is fine!

triggers:
- id: daily
type: io.kestra.core.models.triggers.types.Schedule
cron: "0 9 * * *"
9 changes: 3 additions & 6 deletions blueprints/36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ tasks:
tasks:
- id: downloadCSV
type: io.kestra.plugin.fs.http.Download
uri: https://raw.githubusercontent.com/kestra-io/examples/main/datasets/orders.csv
uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

- id: fetchAuthToken
type: io.kestra.plugin.gcp.auth.OauthAccessToken
projectId: YOUR_GCP_PROJECT_NAME
serviceAccount: "{{ secret('GCP_CREDS') }}"

- id: local
type: io.kestra.core.tasks.storages.LocalFiles
inputs:
data.csv: "{{outputs.downloadCSV.uri}}"

- id: analyzeSales
type: io.kestra.plugin.scripts.python.Script
inputFiles:
data.csv: "{{outputs.downloadCSV.uri}}"
script: |
import pandas as pd
from kestra import Kestra
Expand Down
2 changes: 1 addition & 1 deletion blueprints/38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tasks:
INSTALL httpfs;
LOAD httpfs;
SELECT sum(total) as total, avg(quantity) as avg_quantity
FROM read_csv_auto('https://raw.githubusercontent.com/kestra-io/datasets/main/csv/orders.csv', header=True);
FROM read_csv_auto('https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv', header=True);
fetch: true

- id: slack
Expand Down
19 changes: 8 additions & 11 deletions blueprints/49.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
id: dbtGitDockerBigQuery
id: dbt_bigquery
namespace: blueprint

tasks:
- id: dbt
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: cloneRepository
- id: clone_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: serviceAccount
type: io.kestra.core.tasks.storages.LocalFiles
inputs:
sa.json: "{{ secret('GCP_CREDS') }}"

- id: dbtCore
- id: dbt
type: io.kestra.plugin.dbt.cli.DbtCLI
inputFiles:
sa.json: "{{ secret('GCP_CREDS') }}"
docker:
image: ghcr.io/kestra-io/dbt-bigquery:latest
profiles: |
jaffle_shop:
my_dbt_project:
outputs:
dev:
type: bigquery
Expand Down
14 changes: 12 additions & 2 deletions blueprints/50.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id: dbtGitDockerDuckDB
id: dbt_duckdb
namespace: blueprint

tasks:
Expand All @@ -7,7 +7,7 @@ tasks:
tasks:
- id: cloneRepository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: dbt-build
Expand All @@ -18,3 +18,13 @@ tasks:
commands:
- dbt deps
- dbt build
profiles: |
my_dbt_project:
outputs:
dev:
type: duckdb
path: ":memory:"
fixed_retries: 1
threads: 16
timeout_seconds: 300
target: dev
12 changes: 6 additions & 6 deletions blueprints/51.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
id: dbtGitDockerPostgres
id: dbt_postgres
namespace: blueprint

tasks:
- id: dbt
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: cloneRepository
- id: cloe_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: dbtCore
- id: dbt
type: io.kestra.plugin.dbt.cli.DbtCLI
docker:
image: ghcr.io/kestra-io/dbt-postgres:latest
profiles: |
jaffle_shop:
my_dbt_project:
outputs:
dev:
type: postgres
Expand Down
12 changes: 6 additions & 6 deletions blueprints/52.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
id: dbtGitDockerSnowflake
id: dbt_snowflake
namespace: blueprint

tasks:
- id: dbt
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: cloneRepository
- id: clone_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: dbtCore
- id: dbt
type: io.kestra.plugin.dbt.cli.DbtCLI
docker:
image: ghcr.io/kestra-io/dbt-snowflake:latest
profiles: |
jaffle_shop:
my_dbt_project:
outputs:
dev:
type: snowflake
Expand Down
12 changes: 6 additions & 6 deletions blueprints/53.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
id: dbtGitDockerRedshift
id: dbt_redshift
namespace: blueprint

tasks:
- id: dbt
- id: git
type: io.kestra.core.tasks.flows.WorkingDirectory
tasks:
- id: cloneRepository
- id: clone_repository
type: io.kestra.plugin.git.Clone
url: https://github.com/kestra-io/dbt-demo
url: https://github.com/kestra-io/dbt-example
branch: main

- id: dbtCore
- id: dbt
type: io.kestra.plugin.dbt.cli.DbtCLI
docker:
image: ghcr.io/kestra-io/dbt-redshift:latest
profiles: |
jaffle_shop:
my_dbt_project:
outputs:
dev:
type: redshift
Expand Down
Loading

0 comments on commit 48b32b2

Please sign in to comment.