Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions contrib/templates/scala-job/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.databricks
8 changes: 8 additions & 0 deletions contrib/templates/scala-job/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions contrib/templates/scala-job/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions contrib/templates/scala-job/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions contrib/templates/scala-job/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions contrib/templates/scala-job/.idea/mydabs-template.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions contrib/templates/scala-job/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions contrib/templates/scala-job/databricks_template_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"properties": {
"project_name": {
"type": "string",
"default": "project_name",
"description": "Name of project (press enter to use default name)",
"order": 1
},
"jar_dest_path": {
"type": "string",
"description": "Destination path in Databricks where the JAR will be stored. TODO: instructions on creating /Volumes",
"default": "/Volumes/main/nija/dabs-scala/${workspace.current_user.short_name}",
"order": 3
},
"cluster_key": {
"type": "string",
"description": "Enter the cluster key for an existing cluster or leave empty to create a new cluster",
"default": "",
"order": 5
},
"cluster_type": {
"type": "string",
"enum": ["Standard", "Dedicated"],
"default": "Standard",
"description": "Select cluster type: Dedicated or Standard",
"order": 8
},
"jar_allowlisted": {
"skip_prompt_if": {
"properties": {
"cluster_type": {
"const": "Dedicated"
}
}
},
"type": "boolean",
"description": "If Standard, is the JAR allowlisted by the admin for your workspace? (If not, inform admin: https://docs.databricks.com/en/data-governance/unity-catalog/manage-privileges/allowlist.html, otherwise type true)",
"default": true,
"order": 9
},
"main_class_name": {
"type": "string",
"description": "Main class name including package (entry point of the JAR execution)",
"default": "at.nija.Main",
"order": 10
},
"dbr_version": {
"type": "string",
"description": "Databricks Runtime (DBR) version (e.g., 15.4)",
"default": "15.4",
"order": 11
},
"scala_version": {
"type": "string",
"description": "Scala version (e.g., 2.12). Run scala -version to find it. Note: Only support 2.12 and 2.13",
"default": "2.12",
"order": 12
},
"scala_maintenance_version": {
"type": "string",
"description": "Scala maintenance version (e.g., 12). Run scala -version to find it.",
"default": "18",
"order": 13
},
"organization": {
"type": "string",
"description": "Organization name",
"default": "at.nija",
"order": 14
}
}
}
17 changes: 17 additions & 0 deletions contrib/templates/scala-job/template/build.sbt.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
scalaVersion := "{{.scala_version}}.{{.scala_maintenance_version}}"

name := "{{.project_name}}"
organization := "{{.organization}}"
version := "0.1"

libraryDependencies += "com.databricks" % "databricks-connect" % "{{.dbr_version}}.+"

assembly / assemblyOption ~= { _.withIncludeScala(false) }
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
cp filter { _.data.getName.matches("scala-.*") } // remove Scala libraries
}

assemblyMergeStrategy := {
case _ => MergeStrategy.preferProject
}
54 changes: 54 additions & 0 deletions contrib/templates/scala-job/template/databricks.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a Databricks asset bundle definition for {{.project_name}}.
# See https://docs.databricks.com/dev-tools/bundles/index.html for documentation.
bundle:
name: {{.project_name}}

workspace:
host: {{workspace_host}}
artifact_path: {{.jar_dest_path}}

{{- $version := "0.1" }}

artifacts:
default:
type: jar
build: sbt package && sbt assembly
path: .
files:
- source: ./target/scala-{{.scala_version}}/{{.project_name}}-assembly-{{$version}}.jar

resources:
jobs:
{{.project_name}}:
name: {{.project_name}}
tasks:
- task_key: main_task
{{- if .cluster_key }}
existing_cluster_id: {{.cluster_key}}
{{- else }}
job_cluster_key: {{.project_name}}_job_cluster
{{- end }}
spark_jar_task:
main_class_name: {{.main_class_name}}
libraries:
- jar: ./target/scala-{{.scala_version}}/{{.project_name}}-assembly-{{$version}}.jar
{{- if not .cluster_key }}
job_clusters:
- job_cluster_key: {{.project_name}}_job_cluster
new_cluster:
spark_version: {{.dbr_version}}.x-scala{{.scala_version}}
node_type_id: i3.xlarge # Default instance type (can be changed)
autoscale:
max_workers: 2
min_workers: 2
{{- if eq .cluster_type "Standard" }}
data_security_mode: USER_ISOLATION
{{- end }}
{{- end }}

targets:
dev:
mode: development
default: true
workspace:
host: {{workspace_host}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.0.0")