Skip to content

Commit

Permalink
Refactor doMultiScheduling arguments and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rk1274 committed Sep 26, 2024
1 parent 5d6a377 commit c63be68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cmd/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c63be68

Please sign in to comment.