From c63be68d4d806461c25f05f33dded6f1ba8780cf Mon Sep 17 00:00:00 2001 From: Rosie Kern Date: Thu, 26 Sep 2024 13:28:23 +0100 Subject: [PATCH] Refactor doMultiScheduling arguments and update docs --- cmd/cron.go | 2 +- cmd/multi.go | 6 +++--- scheduler/scheduler.go | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/cron.go b/cmd/cron.go index cae5a561..f91cbce9 100644 --- a/cmd/cron.go +++ b/cmd/cron.go @@ -83,7 +83,7 @@ invocations of cron, do 'sudo wrstsat cron --kill'. taskr := tasker.New(tasker.Option{}) taskr.Task(crontab, func(ctx context.Context) (int, error) { - err := doMultiScheduling(args, sudo) + err := doMultiScheduling(args, workDir, forcedQueue, queuesToAvoid, sudo) if runJobs != "" { os.Exit(0) diff --git a/cmd/multi.go b/cmd/multi.go index f25a6f03..61142eb2 100644 --- a/cmd/multi.go +++ b/cmd/multi.go @@ -144,7 +144,7 @@ exists, and you have a wrstat server using the database files inside, the server will automatically start using the new data and delete the old.`, Run: func(cmd *cobra.Command, args []string) { checkMultiArgs(args) - err := doMultiScheduling(args, sudo) + err := doMultiScheduling(args, workDir, forcedQueue, queuesToAvoid, sudo) if err != nil { die("%s", err) } @@ -209,8 +209,8 @@ func checkStandardFlags() { } // doMultiScheduling does the main work of the multi sub-command. -func doMultiScheduling(args []string, sudo bool) error { - s, d := newScheduler(workDir, forcedQueue, queuesToAvoid, sudo) // TODO +func doMultiScheduling(args []string, workDir, forcedQueue, queuesToAvoid string, sudo bool) error { + s, d := newScheduler(workDir, forcedQueue, queuesToAvoid, sudo) defer d() unique := scheduler.UniqueString() diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 24ea193b..5a8dd07e 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -64,7 +64,8 @@ type Scheduler struct { // New returns a Scheduler that is connected to wr manager using the given // deployment, timeout and logger. Added jobs will have the given cwd, which // matters. If cwd is blank, the current working dir is used. If queue is not -// blank, that queue will be used during NewJob(). +// blank, that queue will be used during NewJob(). If queuesAvoid is not blank, +// queues including that substring will be avoided during NewJob(). func New(deployment, cwd, queue, queuesAvoid string, timeout time.Duration, logger log15.Logger) (*Scheduler, error) { cwd, err := pickCWD(cwd) if err != nil {