cleanup a bit

This commit is contained in:
Shreyas Goenka 2025-01-06 18:49:28 +05:30
parent 4743095adc
commit 57a75190cc
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
4 changed files with 12 additions and 12 deletions

View File

@ -50,7 +50,7 @@ func TestTemplateResolverForDefaultTemplates(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, &builtinReader{name: name}, tmpl.Reader) assert.Equal(t, &builtinReader{name: name}, tmpl.Reader)
assert.IsType(t, &writerWithTelemetry{}, tmpl.Writer) assert.IsType(t, &writerWithFullTelemetry{}, tmpl.Writer)
} }
r := Resolver{ r := Resolver{
@ -63,7 +63,7 @@ func TestTemplateResolverForDefaultTemplates(t *testing.T) {
// Assert reader and writer configuration // Assert reader and writer configuration
assert.Equal(t, "https://github.com/databricks/mlops-stacks", tmpl.Reader.(*gitReader).gitUrl) assert.Equal(t, "https://github.com/databricks/mlops-stacks", tmpl.Reader.(*gitReader).gitUrl)
assert.Equal(t, "/config/file", tmpl.Writer.(*writerWithTelemetry).configPath) assert.Equal(t, "/config/file", tmpl.Writer.(*writerWithFullTelemetry).configPath)
} }
func TestTemplateResolverForCustomUrl(t *testing.T) { func TestTemplateResolverForCustomUrl(t *testing.T) {

View File

@ -39,33 +39,33 @@ var allTemplates = []Template{
name: DefaultPython, name: DefaultPython,
description: "The default Python template for Notebooks / Delta Live Tables / Workflows", description: "The default Python template for Notebooks / Delta Live Tables / Workflows",
Reader: &builtinReader{name: "default-python"}, Reader: &builtinReader{name: "default-python"},
Writer: &writerWithTelemetry{}, Writer: &writerWithFullTelemetry{},
}, },
{ {
name: DefaultSql, name: DefaultSql,
description: "The default SQL template for .sql files that run with Databricks SQL", description: "The default SQL template for .sql files that run with Databricks SQL",
Reader: &builtinReader{name: "default-sql"}, Reader: &builtinReader{name: "default-sql"},
Writer: &writerWithTelemetry{}, Writer: &writerWithFullTelemetry{},
}, },
{ {
name: DbtSql, name: DbtSql,
description: "The dbt SQL template (databricks.com/blog/delivering-cost-effective-data-real-time-dbt-and-databricks)", description: "The dbt SQL template (databricks.com/blog/delivering-cost-effective-data-real-time-dbt-and-databricks)",
Reader: &builtinReader{name: "dbt-sql"}, Reader: &builtinReader{name: "dbt-sql"},
Writer: &writerWithTelemetry{}, Writer: &writerWithFullTelemetry{},
}, },
{ {
name: MlopsStacks, name: MlopsStacks,
description: "The Databricks MLOps Stacks template (github.com/databricks/mlops-stacks)", description: "The Databricks MLOps Stacks template (github.com/databricks/mlops-stacks)",
aliases: []string{"mlops-stack"}, aliases: []string{"mlops-stack"},
Reader: &gitReader{gitUrl: "https://github.com/databricks/mlops-stacks", cloneFunc: git.Clone}, Reader: &gitReader{gitUrl: "https://github.com/databricks/mlops-stacks", cloneFunc: git.Clone},
Writer: &writerWithTelemetry{}, Writer: &writerWithFullTelemetry{},
}, },
{ {
name: DefaultPydabs, name: DefaultPydabs,
hidden: true, hidden: true,
description: "The default PyDABs template", description: "The default PyDABs template",
Reader: &gitReader{gitUrl: "https://databricks.github.io/workflows-authoring-toolkit/pydabs-template.git", cloneFunc: git.Clone}, Reader: &gitReader{gitUrl: "https://databricks.github.io/workflows-authoring-toolkit/pydabs-template.git", cloneFunc: git.Clone},
Writer: &writerWithTelemetry{}, Writer: &writerWithFullTelemetry{},
}, },
{ {
name: Custom, name: Custom,

View File

@ -56,7 +56,7 @@ func TestTemplateTelemetryIsCapturedForAllDefaultTemplates(t *testing.T) {
} else { } else {
// Assert telemetry is captured for all other templates, i.e. templates // Assert telemetry is captured for all other templates, i.e. templates
// owned by databricks. // owned by databricks.
assert.IsType(t, &writerWithTelemetry{}, w) assert.IsType(t, &writerWithFullTelemetry{}, w)
} }
} }
} }

View File

@ -152,15 +152,15 @@ func (tmpl *defaultWriter) Materialize(ctx context.Context, reader Reader) error
} }
func (tmpl *defaultWriter) LogTelemetry(ctx context.Context) error { func (tmpl *defaultWriter) LogTelemetry(ctx context.Context) error {
// no-op // TODO, only log the template name and uuid.
return nil return nil
} }
type writerWithTelemetry struct { type writerWithFullTelemetry struct {
defaultWriter defaultWriter
} }
func (tmpl *writerWithTelemetry) LogTelemetry(ctx context.Context) error { func (tmpl *writerWithFullTelemetry) LogTelemetry(ctx context.Context) error {
// Log telemetry. TODO. // TODO, log template name, uuid and enum args as well.``
return nil return nil
} }