Skip to content

Commit

Permalink
Update template
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkats-db committed Aug 25, 2023
1 parent bc57e53 commit 870825e
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,56 @@
# This is a Databricks Asset Bundle definition for {{.project_name}}.
# See https://docs.databricks.com/en/dev-tools/bundles for documentation.
bundle:
name: {{.project_name}}

include:
- resources/*.yml

artifacts:
{{.project_name}}:
type: whl
path: "."
build: "python3 setup.py bdist_wheel"
{{.project_name}}:
type: whl
path: "."
build: "python3 setup.py bdist_wheel"

targets:
development:
workspace:
host: {{workspace_host}}
# The 'dev' target, used development purposes.
# Whenever a developer deploys using 'dev', they get their own copy.
dev:
# We use 'mode: development' to make everything deployed to this target gets a prefix
# like '[dev my_user_name]'. Setting this mode also disables any schedules and
# automatic triggers for jobs and enables the 'development' mode for DLT pipelines.
mode: development
default: true
workspace:
host: {{workspace_host}}

# Optionally, there could be a 'staging' target here.
# staging:
# workspace:
# host: {{workspace_host}}

# The 'prod' target, used for production deployment.
production:
# For production deployments, we only have a single copy, so we override the
# workspace.root_path default of
# /Users/${workspace.current_user.userName}/.bundle/${bundle.environment}/${bundle.name}
# to a path that is not specific to the current user.
{{- /*
Explaining 'mode: production' isn't as pressing as explaining 'mode: development'.
As we already talked about the other mode above, users can just
look at documentation or ask the assistant about 'mode: production'.
#
# By making use of 'mode: production' we enable strict checks
# to make sure we have correctly configured this target.
*/}}
mode: production
workspace:
host: {{workspace_host}}
root_path: /Shared/.bundle/prod/${bundle.name}
mode: production
{{if is_service_principal}}
{{- else -}}
{{- if not is_service_principal}}
run_as:
user_name: brackets user_name brackets
{{- end -}}
# This runs as {{user_name}} in production. Alternatively,
# a service principal could be used here using service_principal_name
# (see Databricks documentation).
user_name: {{user_name}}
{{end -}}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Fixtures
{{- /*
We don't want to have too many README.md files, since they
stand out so much. But we do need to have a file here to make
sure the folder is added to Git.
*/}}

This folder is reserved for fixtures, such as csv files.

Below is an example of how to load fixtures as a data frame:

```
import pandas as pd

df = pd.read_csv("../fixtures/mycsv.csv")
display(df)
```

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# The main job for {{.project_name}}
resources:

jobs:
{{.project_name}}_job:
name: {{.project_name}}_job

schedule:
quartz_cron_expression: '44 37 8 * * ?'
timezone_id: Europe/Amsterdam

{{- if not is_service_principal}}
email_notifications:
on_failure:
- {{user_name}}
{{end -}}

tasks:
- task_key: notebook_task
job_cluster_key: job_cluster
notebook_task:
notebook_path: ../src/notebook.ipynb

- task_key: python_wheel_task
depends_on:
- task_key: notebook_task
job_cluster_key: job_cluster
python_wheel_task:
package_name: "{{.project_name}}"
entry_point: "main"
libraries:
{{- /* FIXME: this path is wrong, it should say ../dist/*.whl */}}
- whl: dist/*.whl

job_clusters:
- job_cluster_key: job_cluster
new_cluster:
{{- /* we should always use an LTS version in our templates */}}
spark_version: 13.3.x-scala2.12
node_type_id: {{smallest_node_type}}
autoscale:
min_workers: 1
max_workers: 4

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 870825e

Please sign in to comment.