mirror of https://github.com/databricks/cli.git
Rename jobs -> workflows (#111)
This commit is contained in:
parent
c4d63eac70
commit
230811031f
|
@ -4,6 +4,6 @@ import "github.com/databricks/bricks/bundle/config/resources"
|
|||
|
||||
// Resources defines Databricks resources associated with the bundle.
|
||||
type Resources struct {
|
||||
Jobs map[string]resources.Job `json:"jobs,omitempty"`
|
||||
Workflows map[string]resources.Workflow `json:"workflows,omitempty"`
|
||||
Pipelines map[string]resources.Pipeline `json:"pipelines,omitempty"`
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package resources
|
|||
|
||||
import "github.com/databricks/databricks-sdk-go/service/jobs"
|
||||
|
||||
type Job struct {
|
||||
type Workflow struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
*jobs.JobSettings
|
|
@ -36,7 +36,7 @@ type Root struct {
|
|||
Artifacts map[string]*Artifact `json:"artifacts,omitempty"`
|
||||
|
||||
// Resources contains a description of all Databricks resources
|
||||
// to deploy in this bundle (e.g. jobs, pipelines, etc.).
|
||||
// to deploy in this bundle (e.g. workflows, pipelines, etc.).
|
||||
Resources Resources `json:"resources"`
|
||||
|
||||
// Environments can be used to differentiate settings and resources between
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
resources:
|
||||
jobs:
|
||||
my_first_job:
|
||||
id: 1
|
|
@ -0,0 +1,4 @@
|
|||
resources:
|
||||
workflows:
|
||||
my_first_workflow:
|
||||
id: 1
|
|
@ -1,4 +0,0 @@
|
|||
resources:
|
||||
jobs:
|
||||
my_second_job:
|
||||
id: 2
|
|
@ -0,0 +1,4 @@
|
|||
resources:
|
||||
workflows:
|
||||
my_second_workflow:
|
||||
id: 2
|
|
@ -11,10 +11,10 @@ import (
|
|||
func TestIncludeDefault(t *testing.T) {
|
||||
b := load(t, "./include_default")
|
||||
|
||||
// Test that both jobs were loaded.
|
||||
keys := maps.Keys(b.Config.Resources.Jobs)
|
||||
// Test that both workflows were loaded.
|
||||
keys := maps.Keys(b.Config.Resources.Workflows)
|
||||
sort.Strings(keys)
|
||||
assert.Equal(t, []string{"my_first_job", "my_second_job"}, keys)
|
||||
assert.Equal(t, "1", b.Config.Resources.Jobs["my_first_job"].ID)
|
||||
assert.Equal(t, "2", b.Config.Resources.Jobs["my_second_job"].ID)
|
||||
assert.Equal(t, []string{"my_first_workflow", "my_second_workflow"}, keys)
|
||||
assert.Equal(t, "1", b.Config.Resources.Workflows["my_first_workflow"].ID)
|
||||
assert.Equal(t, "2", b.Config.Resources.Workflows["my_second_workflow"].ID)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
resources:
|
||||
jobs:
|
||||
this_job_isnt_defined:
|
||||
workflows:
|
||||
this_workflow_isnt_defined:
|
||||
id: 1
|
||||
|
|
|
@ -8,5 +8,5 @@ import (
|
|||
|
||||
func TestIncludeOverride(t *testing.T) {
|
||||
b := load(t, "./include_override")
|
||||
assert.Empty(t, b.Config.Resources.Jobs)
|
||||
assert.Empty(t, b.Config.Resources.Workflows)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ environments:
|
|||
development: false
|
||||
photon: true
|
||||
|
||||
jobs:
|
||||
workflows:
|
||||
pipeline_schedule:
|
||||
name: Daily refresh of production pipeline
|
||||
|
|
@ -8,8 +8,8 @@ import (
|
|||
)
|
||||
|
||||
func TestJobAndPipelineDevelopment(t *testing.T) {
|
||||
b := loadEnvironment(t, "./job_and_pipeline", "development")
|
||||
assert.Len(t, b.Config.Resources.Jobs, 0)
|
||||
b := loadEnvironment(t, "./workflow_and_pipeline", "development")
|
||||
assert.Len(t, b.Config.Resources.Workflows, 0)
|
||||
assert.Len(t, b.Config.Resources.Pipelines, 1)
|
||||
|
||||
p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"]
|
||||
|
@ -20,8 +20,8 @@ func TestJobAndPipelineDevelopment(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestJobAndPipelineStaging(t *testing.T) {
|
||||
b := loadEnvironment(t, "./job_and_pipeline", "staging")
|
||||
assert.Len(t, b.Config.Resources.Jobs, 0)
|
||||
b := loadEnvironment(t, "./workflow_and_pipeline", "staging")
|
||||
assert.Len(t, b.Config.Resources.Workflows, 0)
|
||||
assert.Len(t, b.Config.Resources.Pipelines, 1)
|
||||
|
||||
p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"]
|
||||
|
@ -32,8 +32,8 @@ func TestJobAndPipelineStaging(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestJobAndPipelineProduction(t *testing.T) {
|
||||
b := loadEnvironment(t, "./job_and_pipeline", "production")
|
||||
assert.Len(t, b.Config.Resources.Jobs, 1)
|
||||
b := loadEnvironment(t, "./workflow_and_pipeline", "production")
|
||||
assert.Len(t, b.Config.Resources.Workflows, 1)
|
||||
assert.Len(t, b.Config.Resources.Pipelines, 1)
|
||||
|
||||
p := b.Config.Resources.Pipelines["nyc_taxi_pipeline"]
|
||||
|
@ -42,7 +42,7 @@ func TestJobAndPipelineProduction(t *testing.T) {
|
|||
assert.Equal(t, "./dlt/nyc_taxi_loader", p.Libraries[0].Notebook.Path)
|
||||
assert.Equal(t, "nyc_taxi_production", p.Target)
|
||||
|
||||
j := b.Config.Resources.Jobs["pipeline_schedule"]
|
||||
j := b.Config.Resources.Workflows["pipeline_schedule"]
|
||||
assert.Equal(t, "Daily refresh of production pipeline", j.Name)
|
||||
require.Len(t, j.Tasks, 1)
|
||||
assert.NotEmpty(t, j.Tasks[0].PipelineTask.PipelineId)
|
|
@ -2,8 +2,8 @@ bundle:
|
|||
name: yaml_anchors
|
||||
|
||||
resources:
|
||||
jobs:
|
||||
my_job:
|
||||
workflows:
|
||||
my_workflow:
|
||||
_: &common_cluster
|
||||
spark_version: "10.4.x-scala2.12"
|
||||
tasks:
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
func TestYAMLAnchors(t *testing.T) {
|
||||
b := load(t, "./yaml_anchors")
|
||||
assert.Len(t, b.Config.Resources.Jobs, 1)
|
||||
assert.Len(t, b.Config.Resources.Workflows, 1)
|
||||
|
||||
j := b.Config.Resources.Jobs["my_job"]
|
||||
j := b.Config.Resources.Workflows["my_workflow"]
|
||||
require.Len(t, j.Tasks, 2)
|
||||
|
||||
t0 := j.Tasks[0]
|
||||
|
|
Loading…
Reference in New Issue