+ // Print version information if requested
+ if *getVersion {
+ fmt.Printf("crunch-dispatch-local %s\n", version)
+ return nil
+ }
+
+ logger.Printf("crunch-dispatch-local %s started", version)
+
+ runningCmds = make(map[string]*exec.Cmd)
+
+ arv, err := arvadosclient.MakeArvadosClient()
+ if err != nil {
+ logger.Errorf("error making Arvados client: %v", err)
+ return err
+ }
+ arv.Retries = 25
+
+ ctx, cancel := context.WithCancel(context.Background())
+
+ dispatcher := dispatch.Dispatcher{
+ Logger: logger,
+ Arv: arv,
+ RunContainer: (&LocalRun{startFunc, make(chan bool, 8), ctx}).run,
+ PollPeriod: time.Duration(*pollInterval) * time.Second,
+ }
+
+ err = dispatcher.Run(ctx)