From f80246289a2d9aa39edfb9d8237a68e5723df51c Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Tue, 20 Aug 2024 12:13:15 -0400 Subject: [PATCH] refactor: rename ApplicationInstanceSpec -> ShellSpec Signed-off-by: Nick Mitchell --- pkg/fe/transformer/api/dispatch/lower.go | 2 +- pkg/fe/transformer/api/dispatch/parametersweep/lower.go | 2 +- pkg/fe/transformer/api/dispatch/s3/lower.go | 2 +- pkg/fe/transformer/api/minio/lower.go | 2 +- pkg/fe/transformer/api/minio/transpile.go | 2 +- pkg/fe/transformer/api/shell/lower.go | 4 ++-- pkg/fe/transformer/api/workerpool/lower.go | 2 +- pkg/fe/transformer/api/workerpool/lowerall.go | 2 +- pkg/fe/transformer/api/workstealer/lower.go | 2 +- pkg/fe/transformer/application.go | 2 +- pkg/fe/transformer/lower.go | 2 +- pkg/ir/llir/{application_instance.go => shell.go} | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) rename pkg/ir/llir/{application_instance.go => shell.go} (92%) diff --git a/pkg/fe/transformer/api/dispatch/lower.go b/pkg/fe/transformer/api/dispatch/lower.go index fc9f3caa..5f394ffe 100644 --- a/pkg/fe/transformer/api/dispatch/lower.go +++ b/pkg/fe/transformer/api/dispatch/lower.go @@ -9,7 +9,7 @@ import ( ) // HLIR -> LLIR for []hlir.ParameterSweep, ... -func Lower(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { +func Lower(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ShellSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { components := []llir.Component{} for _, r := range model.ParameterSweeps { diff --git a/pkg/fe/transformer/api/dispatch/parametersweep/lower.go b/pkg/fe/transformer/api/dispatch/parametersweep/lower.go index 7a72912b..8f0dfd38 100644 --- a/pkg/fe/transformer/api/dispatch/parametersweep/lower.go +++ b/pkg/fe/transformer/api/dispatch/parametersweep/lower.go @@ -7,7 +7,7 @@ import ( "lunchpail.io/pkg/ir/llir" ) -func Lower(compilationName, runname, namespace string, sweep hlir.ParameterSweep, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, sweep hlir.ParameterSweep, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { app, err := transpile(sweep) if err != nil { return llir.Component{}, err diff --git a/pkg/fe/transformer/api/dispatch/s3/lower.go b/pkg/fe/transformer/api/dispatch/s3/lower.go index 0ccb2bc6..6bcc1b3f 100644 --- a/pkg/fe/transformer/api/dispatch/s3/lower.go +++ b/pkg/fe/transformer/api/dispatch/s3/lower.go @@ -7,7 +7,7 @@ import ( "lunchpail.io/pkg/ir/llir" ) -func Lower(compilationName, runname, namespace string, s3 hlir.ProcessS3Objects, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, s3 hlir.ProcessS3Objects, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { app, err := transpile(s3) if err != nil { return llir.Component{}, err diff --git a/pkg/fe/transformer/api/minio/lower.go b/pkg/fe/transformer/api/minio/lower.go index 84f71cc5..c8cbc033 100644 --- a/pkg/fe/transformer/api/minio/lower.go +++ b/pkg/fe/transformer/api/minio/lower.go @@ -8,7 +8,7 @@ import ( "lunchpail.io/pkg/lunchpail" ) -func Lower(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { app, err := transpile(runname, spec) if err != nil { return llir.Component{}, err diff --git a/pkg/fe/transformer/api/minio/transpile.go b/pkg/fe/transformer/api/minio/transpile.go index f7a48c26..90bcf3ef 100644 --- a/pkg/fe/transformer/api/minio/transpile.go +++ b/pkg/fe/transformer/api/minio/transpile.go @@ -12,7 +12,7 @@ import ( ) // Transpile minio to hlir.Application -func transpile(runname string, spec llir.ApplicationInstanceSpec) (hlir.Application, error) { +func transpile(runname string, spec llir.ShellSpec) (hlir.Application, error) { app := hlir.NewApplication(runname + "-minio") app.Spec.Image = "docker.io/minio/minio:RELEASE.2024-07-04T14-25-45Z" diff --git a/pkg/fe/transformer/api/shell/lower.go b/pkg/fe/transformer/api/shell/lower.go index 5d6ab61d..0cc1d562 100644 --- a/pkg/fe/transformer/api/shell/lower.go +++ b/pkg/fe/transformer/api/shell/lower.go @@ -14,7 +14,7 @@ import ( "lunchpail.io/pkg/util" ) -func Lower(compilationName, runname, namespace string, app hlir.Application, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, app hlir.Application, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { var component lunchpail.Component switch app.Spec.Role { case "worker": @@ -26,7 +26,7 @@ func Lower(compilationName, runname, namespace string, app hlir.Application, spe return LowerAsComponent(compilationName, runname, namespace, app, spec, opts, verbose, component) } -func LowerAsComponent(compilationName, runname, namespace string, app hlir.Application, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool, component lunchpail.Component) (llir.Component, error) { +func LowerAsComponent(compilationName, runname, namespace string, app hlir.Application, spec llir.ShellSpec, opts compilation.Options, verbose bool, component lunchpail.Component) (llir.Component, error) { sizing := spec.Sizing if sizing.Workers == 0 { sizing = api.ApplicationSizing(app, opts) diff --git a/pkg/fe/transformer/api/workerpool/lower.go b/pkg/fe/transformer/api/workerpool/lower.go index e2068e21..8b6d14fa 100644 --- a/pkg/fe/transformer/api/workerpool/lower.go +++ b/pkg/fe/transformer/api/workerpool/lower.go @@ -12,7 +12,7 @@ import ( "lunchpail.io/pkg/lunchpail" ) -func Lower(compilationName, runname, namespace string, app hlir.Application, pool hlir.WorkerPool, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, app hlir.Application, pool hlir.WorkerPool, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { spec.RunAsJob = true spec.Sizing = api.WorkerpoolSizing(pool, app, opts) spec.InstanceName = pool.Metadata.Name diff --git a/pkg/fe/transformer/api/workerpool/lowerall.go b/pkg/fe/transformer/api/workerpool/lowerall.go index 1573be1d..a7910abc 100644 --- a/pkg/fe/transformer/api/workerpool/lowerall.go +++ b/pkg/fe/transformer/api/workerpool/lowerall.go @@ -9,7 +9,7 @@ import ( ) // HLIR -> LLIR for []hlir.WorkerPool -func LowerAll(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { +func LowerAll(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ShellSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { components := []llir.Component{} app, found := model.GetApplicationByRole(hlir.WorkerRole) diff --git a/pkg/fe/transformer/api/workstealer/lower.go b/pkg/fe/transformer/api/workstealer/lower.go index 95b6aa3c..00f2793a 100644 --- a/pkg/fe/transformer/api/workstealer/lower.go +++ b/pkg/fe/transformer/api/workstealer/lower.go @@ -8,7 +8,7 @@ import ( "lunchpail.io/pkg/lunchpail" ) -func Lower(compilationName, runname, namespace string, app hlir.Application, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) (llir.Component, error) { +func Lower(compilationName, runname, namespace string, app hlir.Application, spec llir.ShellSpec, opts compilation.Options, verbose bool) (llir.Component, error) { app, err := transpile(runname) if err != nil { return llir.Component{}, err diff --git a/pkg/fe/transformer/application.go b/pkg/fe/transformer/application.go index dfe595b5..04e41bf7 100644 --- a/pkg/fe/transformer/application.go +++ b/pkg/fe/transformer/application.go @@ -9,7 +9,7 @@ import ( ) // HLIR -> LLIR for []hlir.Application -func lowerApplications(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ApplicationInstanceSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { +func lowerApplications(compilationName, runname, namespace string, model hlir.AppModel, spec llir.ShellSpec, opts compilation.Options, verbose bool) ([]llir.Component, error) { components := []llir.Component{} for _, r := range model.Applications { diff --git a/pkg/fe/transformer/lower.go b/pkg/fe/transformer/lower.go index 2d6882ad..6a4e5b2a 100644 --- a/pkg/fe/transformer/lower.go +++ b/pkg/fe/transformer/lower.go @@ -14,7 +14,7 @@ import ( // HLIR -> LLIR func Lower(compilationName, runname, namespace string, model hlir.AppModel, queueSpec queue.Spec, yamlValues string, opts compilation.Options, verbose bool) (llir.LLIR, error) { - spec := llir.ApplicationInstanceSpec{Queue: queueSpec, Values: llir.Values{Yaml: yamlValues}} + spec := llir.ShellSpec{Queue: queueSpec, Values: llir.Values{Yaml: yamlValues}} minio, err := minio.Lower(compilationName, runname, namespace, model, spec, opts, verbose) if err != nil { diff --git a/pkg/ir/llir/application_instance.go b/pkg/ir/llir/shell.go similarity index 92% rename from pkg/ir/llir/application_instance.go rename to pkg/ir/llir/shell.go index cb12d380..0c6648a3 100644 --- a/pkg/ir/llir/application_instance.go +++ b/pkg/ir/llir/shell.go @@ -8,7 +8,7 @@ type Values struct { Yaml string } -type ApplicationInstanceSpec struct { +type ShellSpec struct { // Use a Job-style (versus Pod-style) of deployment? RunAsJob bool