Skip to content

Commit

Permalink
fix: use shorter names for default pool and local workers
Browse files Browse the repository at this point in the history
Also
- updates `queue ls` to show only main queue items by default. Now `queue ls all` will show everything.
- fixes `queue ls` as it was only showing items from first step

Signed-off-by: Nick Mitchell <[email protected]>
  • Loading branch information
starpit committed Nov 11, 2024
1 parent bf1c2e3 commit e88ebe9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/be/local/shell/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func SpawnJob(ctx context.Context, c llir.ShellComponent, ir llir.LLIR, logdir s

for workerIdx := range c.Sizing.Workers {
group.Go(func() error {
return Spawn(jobCtx, c.WithInstanceNameSuffix(fmt.Sprintf("-w%d", workerIdx)), ir, logdir, opts)
return Spawn(jobCtx, c.WithInstanceName(fmt.Sprintf("w%d", workerIdx)), ir, logdir, opts)
})
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/fe/builder/overlay/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func evalApp(eval string, opts Options) hlir.HLIR {

return hlir.HLIR{
Applications: []hlir.Application{app},
WorkerPools: []hlir.WorkerPool{hlir.NewPool("default", opts.BuildOptions.Workers)},
WorkerPools: []hlir.WorkerPool{hlir.NewPool("p1", opts.BuildOptions.Workers)},
}
}

Expand Down
8 changes: 6 additions & 2 deletions pkg/ir/llir/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ func (c ShellComponent) SetWorkers(w int) Component {
return c // FIXME
}

func (c ShellComponent) WithInstanceNameSuffix(suffix string) ShellComponent {
c.InstanceName = c.InstanceName + suffix
func (c ShellComponent) WithInstanceName(name string) ShellComponent {
c.InstanceName = name
return c
}

func (c ShellComponent) WithInstanceNameSuffix(suffix string) ShellComponent {
return c.WithInstanceName(c.InstanceName + suffix)
}
2 changes: 1 addition & 1 deletion pkg/runtime/builtins/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ mv $1 $2`},

return hlir.HLIR{
Applications: []hlir.Application{app},
WorkerPools: []hlir.WorkerPool{hlir.NewPool("default", 1)},
WorkerPools: []hlir.WorkerPool{hlir.NewPool("p1", 1)},
}
}
7 changes: 5 additions & 2 deletions pkg/runtime/queue/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package queue

import (
"context"
"regexp"
"strings"

"lunchpail.io/pkg/be"
Expand Down Expand Up @@ -35,9 +36,11 @@ func Ls(ctx context.Context, backend be.Backend, run queue.RunContext, path stri
case "blobs":
prefix = wildcard.AsFile(queue.Blobs)
default:
prefix = wildcard.ListenPrefix()
prefix = wildcard.ListenPrefixForAnyStep(true)
}

nonqueue := regexp.MustCompile("dead|succeeded|dispatcherdone|alive|killfile")

files := make(chan string)
errors := make(chan error)
go func() {
Expand All @@ -49,7 +52,7 @@ func Ls(ctx context.Context, backend be.Backend, run queue.RunContext, path stri
errors <- o.Err
} else {
f := strings.Replace(o.Key, prefix+"/", "", 1)
if f != "" {
if f != "" && path == "all" || !nonqueue.MatchString(f) {
files <- f
}
}
Expand Down

0 comments on commit e88ebe9

Please sign in to comment.