Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ibmcloud be to use local setup rather than k8 kind cluster #537

Merged
merged 1 commit into from
Jan 8, 2025
Merged
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
1 change: 1 addition & 0 deletions cmd/subcommands/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ func init() {
cmd.AddCommand(component.Minio())
cmd.AddCommand(component.Worker())
cmd.AddCommand(component.WorkStealer())
cmd.AddCommand(component.RunLocally())
}
42 changes: 42 additions & 0 deletions cmd/subcommands/component/run-locally.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package component

import (
"context"

"github.com/spf13/cobra"
"lunchpail.io/cmd/options"
"lunchpail.io/pkg/build"
"lunchpail.io/pkg/runtime"
)

type RunLocallyOptions struct {
Component string
LLIR string
build.LogOptions
}

func AddRunLocallyOptions(cmd *cobra.Command) *RunLocallyOptions {
options := RunLocallyOptions{}
cmd.Flags().StringVarP(&options.Component, "component", "", "", "")
cmd.Flags().StringVar(&options.LLIR, "llir", "", "")
cmd.MarkFlagRequired("component")
cmd.MarkFlagRequired("llir")
return &options
}

func RunLocally() *cobra.Command {
cmd := &cobra.Command{
Use: "run-locally",
Short: "Commands for running a component locally",
Long: "Commands for running a component locally",
}

runOpts := AddRunLocallyOptions(cmd)
options.AddLogOptions(cmd)

cmd.RunE = func(cmd *cobra.Command, args []string) error {
return runtime.RunLocally(context.Background(), runOpts.Component, runOpts.LLIR, runOpts.LogOptions)
}

return cmd
}
2 changes: 2 additions & 0 deletions cmd/subcommands/component/worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package worker
import (
"context"
"fmt"
"time"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -64,6 +65,7 @@ func Run() *cobra.Command {
PollingInterval: pollingInterval,
LogOptions: *logOpts,
RunContext: run.ForStep(step).ForPool(poolName).ForWorker(workerName),
WorkerStartTime: time.Now(),
})
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/subcommands/queue/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Cat() *cobra.Command {
return err
}

return queue.Qcat(ctx, backend, run, args[0], *opts.Log)
return queue.Qcat(ctx, backend, run, args[0], q.Spec{}, *opts.Log)
}

return cmd
Expand Down
2 changes: 1 addition & 1 deletion cmd/subcommands/queue/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Drain() *cobra.Command {
return err
}

return queue.Drain(ctx, backend, run.ForStep(step), *opts.Log)
return queue.Drain(ctx, backend, run.ForStep(step), q.Spec{}, *opts.Log)
}

return cmd
Expand Down
2 changes: 1 addition & 1 deletion cmd/subcommands/queue/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Ls() *cobra.Command {
return err
}

files, errors, err := queue.Ls(ctx, backend, runContext.ForStep(step), path, *opts.Log)
files, errors, err := queue.Ls(ctx, backend, runContext.ForStep(step), path, q.Spec{}, *opts.Log)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/subcommands/queue/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Upload() *cobra.Command {
run = rrun.Name
}

return queue.UploadFiles(ctx, backend, q.RunContext{RunName: run}, []upload.Upload{upload.Upload{LocalPath: args[0], Bucket: args[1]}}, *opts.Log)
return queue.UploadFiles(ctx, backend, q.RunContext{RunName: run}, []upload.Upload{upload.Upload{LocalPath: args[0], Bucket: args[1]}}, q.Spec{}, *opts.Log)
}

return cmd
Expand Down
9 changes: 8 additions & 1 deletion cmd/subcommands/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ package subcommands

import (
"context"
"fmt"
"os"
"time"

"github.com/spf13/cobra"

Expand Down Expand Up @@ -68,7 +70,12 @@ func newUpCmd() *cobra.Command {
return err
}

_, err = boot.Up(ctx, backend, boot.UpOptions{BuildOptions: *buildOpts, DryRun: dryrunFlag, Watch: watchFlag, WatchUtil: watchFlag, Inputs: args, Executable: os.Args[0], NoRedirect: noRedirect})
upStartTime := time.Now()
_, err = boot.Up(ctx, backend, boot.UpOptions{BuildOptions: *buildOpts, DryRun: dryrunFlag, Watch: watchFlag, WatchUtil: watchFlag, Inputs: args, Executable: os.Args[0], NoRedirect: noRedirect, UpStartTime: time.Now()})
upEndTime := time.Now()
if buildOpts.Verbose() {
fmt.Fprintf(os.Stderr, "METRICS: Took %s for running app e2e\n", util.RelTime(upStartTime, upEndTime))
}
return err
}

Expand Down
2 changes: 1 addition & 1 deletion demos/data-prep-kit/code/header-cleanser/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ scancode-toolkit-mini
# we can probably update to 18+, but we will have to re-generate expected output as pyarrow 18 seems to have resulted in a binary format change
pyarrow<17

setuptools
setuptools ; platform_system == 'Darwin'
2 changes: 1 addition & 1 deletion demos/data-prep-kit/language/lang-id/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hmm, needed for tests at least on macos
wheel
setuptools
setuptools ; platform_system == 'Darwin'

fasttext-wheel==0.9.2
langcodes==3.3.0
Expand Down
2 changes: 1 addition & 1 deletion demos/data-prep-kit/universal/doc-id/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyarrow<17
setuptools
setuptools ; platform_system == 'Darwin'
2 changes: 1 addition & 1 deletion pkg/be/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Backend interface {
InstanceCount(ctx context.Context, c lunchpail.Component, run queue.RunContext) (int, error)

// Queue properties for a given run, plus ensure access to the endpoint from this client
AccessQueue(ctx context.Context, run queue.RunContext, opts build.LogOptions) (endpoint, accessKeyID, secretAccessKey, bucket string, stop func(), err error)
AccessQueue(ctx context.Context, run queue.RunContext, queue queue.Spec, opts build.LogOptions) (endpoint, accessKeyID, secretAccessKey, bucket string, stop func(), err error)

// Return a streamer
Streamer(ctx context.Context, run queue.RunContext) streamer.Streamer
Expand Down
Loading
Loading