From: Peter Amstutz Date: Fri, 24 Aug 2018 19:33:05 +0000 (-0400) Subject: Merge branch '14075-uploadfiles' refs #14075 X-Git-Tag: 1.2.0~9 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/5b8dfb5d5f4b34fa730e69c45c517f0cfb3fdc9f?hp=95e5ccacf6c1193b313fa90a6d39baafa2ba67d8 Merge branch '14075-uploadfiles' refs #14075 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/sdk/go/arvadosclient/arvadosclient.go b/sdk/go/arvadosclient/arvadosclient.go index 91da5a3fd6..e3a9f4ae8d 100644 --- a/sdk/go/arvadosclient/arvadosclient.go +++ b/sdk/go/arvadosclient/arvadosclient.go @@ -173,8 +173,11 @@ func New(c *arvados.Client) (*ArvadosClient, error) { ApiServer: c.APIHost, ApiToken: c.AuthToken, ApiInsecure: c.Insecure, - Client: &http.Client{Transport: &http.Transport{ - TLSClientConfig: MakeTLSConfig(c.Insecure)}}, + Client: &http.Client{ + Timeout: 5 * time.Minute, + Transport: &http.Transport{ + TLSClientConfig: MakeTLSConfig(c.Insecure)}, + }, External: false, Retries: 2, KeepServiceURIs: c.KeepServiceURIs, diff --git a/sdk/go/dispatch/dispatch.go b/sdk/go/dispatch/dispatch.go index 4e25ba4f06..c8fb5aeb37 100644 --- a/sdk/go/dispatch/dispatch.go +++ b/sdk/go/dispatch/dispatch.go @@ -9,12 +9,12 @@ package dispatch import ( "context" "fmt" - "log" "sync" "time" "git.curoverse.com/arvados.git/sdk/go/arvados" "git.curoverse.com/arvados.git/sdk/go/arvadosclient" + "github.com/Sirupsen/logrus" ) const ( @@ -25,10 +25,18 @@ const ( Cancelled = arvados.ContainerStateCancelled ) +type Logger interface { + Printf(string, ...interface{}) + Warnf(string, ...interface{}) + Debugf(string, ...interface{}) +} + // Dispatcher struct type Dispatcher struct { Arv *arvadosclient.ArvadosClient + Logger Logger + // Batch size for container queries BatchSize int64 @@ -65,6 +73,10 @@ type DispatchFunc func(*Dispatcher, arvados.Container, <-chan arvados.Container) // dispatcher's token. When a new one appears, Run calls RunContainer // in a new goroutine. func (d *Dispatcher) Run(ctx context.Context) error { + if d.Logger == nil { + d.Logger = logrus.StandardLogger() + } + err := d.Arv.Call("GET", "api_client_authorizations", "", "current", nil, &d.auth) if err != nil { return fmt.Errorf("error getting my token UUID: %v", err) @@ -142,7 +154,7 @@ func (d *Dispatcher) Run(ctx context.Context) error { // Containers that I know about that didn't show up in any // query should be let go. for uuid, tracker := range todo { - log.Printf("Container %q not returned by any query, stopping tracking.", uuid) + d.Logger.Printf("Container %q not returned by any query, stopping tracking.", uuid) tracker.close() } @@ -152,7 +164,10 @@ func (d *Dispatcher) Run(ctx context.Context) error { // Start a runner in a new goroutine, and send the initial container // record to its updates channel. func (d *Dispatcher) start(c arvados.Container) *runTracker { - tracker := &runTracker{updates: make(chan arvados.Container, 1)} + tracker := &runTracker{ + updates: make(chan arvados.Container, 1), + logger: d.Logger, + } tracker.updates <- c go func() { d.RunContainer(d, c, tracker.updates) @@ -174,7 +189,7 @@ func (d *Dispatcher) checkForUpdates(filters [][]interface{}, todo map[string]*r "order": []string{"priority desc"}} err := d.Arv.List("containers", params, &countList) if err != nil { - log.Printf("error getting count of containers: %q", err) + d.Logger.Warnf("error getting count of containers: %q", err) return false } itemsAvailable := countList.ItemsAvailable @@ -195,7 +210,7 @@ func (d *Dispatcher) checkForUpdates(filters [][]interface{}, todo map[string]*r err := d.Arv.List("containers", params, &list) if err != nil { - log.Printf("Error getting list of containers: %q", err) + d.Logger.Warnf("error getting list of containers: %q", err) return false } d.checkListForUpdates(list.Items, todo) @@ -218,7 +233,7 @@ func (d *Dispatcher) checkListForUpdates(containers []arvados.Container, todo ma delete(todo, c.UUID) if c.LockedByUUID != "" && c.LockedByUUID != d.auth.UUID { - log.Printf("debug: ignoring %s locked by %s", c.UUID, c.LockedByUUID) + d.Logger.Debugf("ignoring %s locked by %s", c.UUID, c.LockedByUUID) } else if alreadyTracking { switch c.State { case Queued: @@ -236,7 +251,7 @@ func (d *Dispatcher) checkListForUpdates(containers []arvados.Container, todo ma } err := d.lock(c.UUID) if err != nil { - log.Printf("debug: error locking container %s: %s", c.UUID, err) + d.Logger.Warnf("error locking container %s: %s", c.UUID, err) break } c.State = Locked @@ -260,7 +275,7 @@ func (d *Dispatcher) UpdateState(uuid string, state arvados.ContainerState) erro "container": arvadosclient.Dict{"state": state}, }, nil) if err != nil { - log.Printf("Error updating container %s to state %q: %s", uuid, state, err) + d.Logger.Warnf("error updating container %s to state %q: %s", uuid, state, err) } return err } @@ -315,6 +330,7 @@ func (d *Dispatcher) TrackContainer(uuid string) error { type runTracker struct { closing bool updates chan arvados.Container + logger Logger } func (tracker *runTracker) close() { @@ -330,7 +346,7 @@ func (tracker *runTracker) update(c arvados.Container) { } select { case <-tracker.updates: - log.Printf("debug: runner is handling updates slowly, discarded previous update for %s", c.UUID) + tracker.logger.Debugf("runner is handling updates slowly, discarded previous update for %s", c.UUID) default: } tracker.updates <- c diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go index 279327ba18..fc10393626 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local.go @@ -10,7 +10,6 @@ import ( "context" "flag" "fmt" - "log" "os" "os/exec" "os/signal" @@ -21,6 +20,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvados" "git.curoverse.com/arvados.git/sdk/go/arvadosclient" "git.curoverse.com/arvados.git/sdk/go/dispatch" + "github.com/Sirupsen/logrus" ) var version = "dev" @@ -28,7 +28,7 @@ var version = "dev" func main() { err := doMain() if err != nil { - log.Fatalf("%q", err) + logrus.Fatalf("%q", err) } } @@ -40,6 +40,14 @@ var ( ) func doMain() error { + logger := logrus.StandardLogger() + if os.Getenv("DEBUG") != "" { + logger.SetLevel(logrus.DebugLevel) + } + logger.Formatter = &logrus.JSONFormatter{ + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", + } + flags := flag.NewFlagSet("crunch-dispatch-local", flag.ExitOnError) pollInterval := flags.Int( @@ -66,18 +74,19 @@ func doMain() error { return nil } - log.Printf("crunch-dispatch-local %s started", version) + logger.Printf("crunch-dispatch-local %s started", version) runningCmds = make(map[string]*exec.Cmd) arv, err := arvadosclient.MakeArvadosClient() if err != nil { - log.Printf("Error making Arvados client: %v", err) + logger.Errorf("error making Arvados client: %v", err) return err } arv.Retries = 25 dispatcher := dispatch.Dispatcher{ + Logger: logger, Arv: arv, RunContainer: run, PollPeriod: time.Duration(*pollInterval) * time.Second, @@ -92,7 +101,7 @@ func doMain() error { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT) sig := <-c - log.Printf("Received %s, shutting down", sig) + logger.Printf("Received %s, shutting down", sig) signal.Stop(c) cancel() @@ -138,7 +147,7 @@ func run(dispatcher *dispatch.Dispatcher, cmd.Stderr = os.Stderr cmd.Stdout = os.Stderr - log.Printf("Starting container %v", uuid) + dispatcher.Logger.Printf("starting container %v", uuid) // Add this crunch job to the list of runningCmds only if we // succeed in starting crunch-run. @@ -146,7 +155,7 @@ func run(dispatcher *dispatch.Dispatcher, runningCmdsMutex.Lock() if err := startCmd(container, cmd); err != nil { runningCmdsMutex.Unlock() - log.Printf("Error starting %v for %v: %q", *crunchRunCommand, uuid, err) + dispatcher.Logger.Warnf("error starting %q for %s: %s", *crunchRunCommand, uuid, err) dispatcher.UpdateState(uuid, dispatch.Cancelled) } else { runningCmds[uuid] = cmd @@ -157,9 +166,9 @@ func run(dispatcher *dispatch.Dispatcher, go func() { if _, err := cmd.Process.Wait(); err != nil { - log.Printf("Error while waiting for crunch job to finish for %v: %q", uuid, err) + dispatcher.Logger.Warnf("error while waiting for crunch job to finish for %v: %q", uuid, err) } - log.Printf("sending done") + dispatcher.Logger.Debugf("sending done") done <- struct{}{} }() @@ -171,14 +180,14 @@ func run(dispatcher *dispatch.Dispatcher, case c := <-status: // Interrupt the child process if priority changes to 0 if (c.State == dispatch.Locked || c.State == dispatch.Running) && c.Priority == 0 { - log.Printf("Sending SIGINT to pid %d to cancel container %v", cmd.Process.Pid, uuid) + dispatcher.Logger.Printf("sending SIGINT to pid %d to cancel container %v", cmd.Process.Pid, uuid) cmd.Process.Signal(os.Interrupt) } } } close(done) - log.Printf("Finished container run for %v", uuid) + dispatcher.Logger.Printf("finished container run for %v", uuid) // Remove the crunch job from runningCmds runningCmdsMutex.Lock() @@ -191,11 +200,11 @@ func run(dispatcher *dispatch.Dispatcher, // If the container is not finalized, then change it to "Cancelled". err := dispatcher.Arv.Get("containers", uuid, nil, &container) if err != nil { - log.Printf("Error getting final container state: %v", err) + dispatcher.Logger.Warnf("error getting final container state: %v", err) } if container.State == dispatch.Locked || container.State == dispatch.Running { - log.Printf("After %s process termination, container state for %v is %q. Updating it to %q", - *crunchRunCommand, container.State, uuid, dispatch.Cancelled) + dispatcher.Logger.Warnf("after %q process termination, container state for %v is %q; updating it to %q", + *crunchRunCommand, uuid, container.State, dispatch.Cancelled) dispatcher.UpdateState(uuid, dispatch.Cancelled) } @@ -203,5 +212,5 @@ func run(dispatcher *dispatch.Dispatcher, for range status { } - log.Printf("Finalized container %v", uuid) + dispatcher.Logger.Printf("finalized container %v", uuid) } diff --git a/services/crunch-dispatch-local/crunch-dispatch-local_test.go b/services/crunch-dispatch-local/crunch-dispatch-local_test.go index 534de6916c..6da17ea86c 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local_test.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local_test.go @@ -8,12 +8,11 @@ import ( "bytes" "context" "io" - "log" "net/http" "net/http/httptest" "os" "os/exec" - "strings" + "regexp" "testing" "time" @@ -21,6 +20,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvadosclient" "git.curoverse.com/arvados.git/sdk/go/arvadostest" "git.curoverse.com/arvados.git/sdk/go/dispatch" + "github.com/Sirupsen/logrus" . "gopkg.in/check.v1" ) @@ -41,6 +41,7 @@ func (s *TestSuite) SetUpSuite(c *C) { initialArgs = os.Args arvadostest.StartAPI() runningCmds = make(map[string]*exec.Cmd) + logrus.SetFormatter(&logrus.TextFormatter{DisableColors: true}) } func (s *TestSuite) TearDownSuite(c *C) { @@ -133,7 +134,7 @@ func (s *MockArvadosServerSuite) Test_ContainerStillInRunningAfterRun(c *C) { arvadostest.StubResponse{200, string(`{"uuid":"zzzzz-dz642-xxxxxxxxxxxxxx2", "state":"Running", "priority":1, "locked_by_uuid": "` + arvadostest.Dispatch1AuthUUID + `"}`)} testWithServerStub(c, apiStubResponses, "echo", - `After echo process termination, container state for Running is "zzzzz-dz642-xxxxxxxxxxxxxx2". Updating it to "Cancelled"`) + `after \\"echo\\" process termination, container state for zzzzz-dz642-xxxxxxxxxxxxxx2 is \\"Running\\"; updating it to \\"Cancelled\\"`) } func (s *MockArvadosServerSuite) Test_ErrorRunningContainer(c *C) { @@ -144,7 +145,7 @@ func (s *MockArvadosServerSuite) Test_ErrorRunningContainer(c *C) { apiStubResponses["/arvados/v1/containers/zzzzz-dz642-xxxxxxxxxxxxxx3/lock"] = arvadostest.StubResponse{200, string(`{"uuid":"zzzzz-dz642-xxxxxxxxxxxxxx3", "state":"Locked", "priority":1}`)} - testWithServerStub(c, apiStubResponses, "nosuchcommand", "Error starting nosuchcommand for zzzzz-dz642-xxxxxxxxxxxxxx3") + testWithServerStub(c, apiStubResponses, "nosuchcommand", `error starting \\"nosuchcommand\\" for zzzzz-dz642-xxxxxxxxxxxxxx3`) } func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubResponse, crunchCmd string, expected string) { @@ -165,15 +166,15 @@ func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon } buf := bytes.NewBuffer(nil) - log.SetOutput(io.MultiWriter(buf, os.Stderr)) - defer log.SetOutput(os.Stderr) + logrus.SetOutput(io.MultiWriter(buf, os.Stderr)) + defer logrus.SetOutput(os.Stderr) *crunchRunCommand = crunchCmd ctx, cancel := context.WithCancel(context.Background()) dispatcher := dispatch.Dispatcher{ Arv: arv, - PollPeriod: time.Duration(1) * time.Second, + PollPeriod: time.Second / 20, RunContainer: func(d *dispatch.Dispatcher, c arvados.Container, s <-chan arvados.Container) { run(d, c, s) cancel() @@ -186,8 +187,9 @@ func testWithServerStub(c *C, apiStubResponses map[string]arvadostest.StubRespon return cmd.Start() } + re := regexp.MustCompile(`(?ms).*` + expected + `.*`) go func() { - for i := 0; i < 80 && !strings.Contains(buf.String(), expected); i++ { + for i := 0; i < 80 && !re.MatchString(buf.String()); i++ { time.Sleep(100 * time.Millisecond) } cancel() diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go index 36ef264963..ce0360261d 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go @@ -23,9 +23,15 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvadosclient" "git.curoverse.com/arvados.git/sdk/go/config" "git.curoverse.com/arvados.git/sdk/go/dispatch" + "github.com/Sirupsen/logrus" "github.com/coreos/go-systemd/daemon" ) +type logger interface { + dispatch.Logger + Fatalf(string, ...interface{}) +} + const initialNiceValue int64 = 10000 var ( @@ -35,6 +41,7 @@ var ( type Dispatcher struct { *dispatch.Dispatcher + logger logrus.FieldLogger cluster *arvados.Cluster sqCheck *SqueueChecker slurm Slurm @@ -63,10 +70,17 @@ type Dispatcher struct { } func main() { - disp := &Dispatcher{} + logger := logrus.StandardLogger() + if os.Getenv("DEBUG") != "" { + logger.SetLevel(logrus.DebugLevel) + } + logger.Formatter = &logrus.JSONFormatter{ + TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", + } + disp := &Dispatcher{logger: logger} err := disp.Run(os.Args[0], os.Args[1:]) if err != nil { - log.Fatal(err) + logrus.Fatalf("%s", err) } } @@ -104,7 +118,7 @@ func (disp *Dispatcher) configure(prog string, args []string) error { return nil } - log.Printf("crunch-dispatch-slurm %s started", version) + disp.logger.Printf("crunch-dispatch-slurm %s started", version) err := disp.readConfig(*configPath) if err != nil { @@ -132,7 +146,7 @@ func (disp *Dispatcher) configure(prog string, args []string) error { os.Setenv("ARVADOS_KEEP_SERVICES", strings.Join(disp.Client.KeepServiceURIs, " ")) os.Setenv("ARVADOS_EXTERNAL_CLIENT", "") } else { - log.Printf("warning: Client credentials missing from config, so falling back on environment variables (deprecated).") + disp.logger.Warnf("Client credentials missing from config, so falling back on environment variables (deprecated).") } if *dumpConfig { @@ -141,7 +155,7 @@ func (disp *Dispatcher) configure(prog string, args []string) error { siteConfig, err := arvados.GetConfig(arvados.DefaultConfigFile) if os.IsNotExist(err) { - log.Printf("warning: no cluster config (%s), proceeding with no node types defined", err) + disp.logger.Warnf("no cluster config (%s), proceeding with no node types defined", err) } else if err != nil { return fmt.Errorf("error loading config: %s", err) } else if disp.cluster, err = siteConfig.GetCluster(""); err != nil { @@ -153,20 +167,25 @@ func (disp *Dispatcher) configure(prog string, args []string) error { // setup() initializes private fields after configure(). func (disp *Dispatcher) setup() { + if disp.logger == nil { + disp.logger = logrus.StandardLogger() + } arv, err := arvadosclient.MakeArvadosClient() if err != nil { - log.Fatalf("Error making Arvados client: %v", err) + disp.logger.Fatalf("Error making Arvados client: %v", err) } arv.Retries = 25 disp.slurm = &slurmCLI{} disp.sqCheck = &SqueueChecker{ + Logger: disp.logger, Period: time.Duration(disp.PollPeriod), PrioritySpread: disp.PrioritySpread, Slurm: disp.slurm, } disp.Dispatcher = &dispatch.Dispatcher{ Arv: arv, + Logger: disp.logger, BatchSize: disp.BatchSize, RunContainer: disp.runContainer, PollPeriod: time.Duration(disp.PollPeriod), @@ -325,7 +344,7 @@ func (disp *Dispatcher) runContainer(_ *dispatch.Dispatcher, ctr arvados.Contain case <-ctx.Done(): // Disappeared from squeue if err := disp.Arv.Get("containers", ctr.UUID, nil, &ctr); err != nil { - log.Printf("Error getting final container state for %s: %s", ctr.UUID, err) + log.Printf("error getting final container state for %s: %s", ctr.UUID, err) } switch ctr.State { case dispatch.Running: diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go index 33cad3af1f..b76ece314d 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm_test.go @@ -11,7 +11,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "net/http" "net/http/httptest" "os" @@ -25,6 +24,7 @@ import ( "git.curoverse.com/arvados.git/sdk/go/arvadosclient" "git.curoverse.com/arvados.git/sdk/go/arvadostest" "git.curoverse.com/arvados.git/sdk/go/dispatch" + "github.com/Sirupsen/logrus" . "gopkg.in/check.v1" ) @@ -138,7 +138,11 @@ func (s *IntegrationSuite) integrationTest(c *C, } s.disp.slurm = &s.slurm - s.disp.sqCheck = &SqueueChecker{Period: 500 * time.Millisecond, Slurm: s.disp.slurm} + s.disp.sqCheck = &SqueueChecker{ + Logger: logrus.StandardLogger(), + Period: 500 * time.Millisecond, + Slurm: s.disp.slurm, + } err = s.disp.Dispatcher.Run(ctx) <-doneRun @@ -264,8 +268,8 @@ func (s *StubbedSuite) testWithServerStub(c *C, apiStubResponses map[string]arva } buf := bytes.NewBuffer(nil) - log.SetOutput(io.MultiWriter(buf, os.Stderr)) - defer log.SetOutput(os.Stderr) + logrus.SetOutput(io.MultiWriter(buf, os.Stderr)) + defer logrus.SetOutput(os.Stderr) s.disp.CrunchRunCommand = []string{crunchCmd} diff --git a/services/crunch-dispatch-slurm/squeue.go b/services/crunch-dispatch-slurm/squeue.go index 0ce4fb6732..5aee7e087b 100644 --- a/services/crunch-dispatch-slurm/squeue.go +++ b/services/crunch-dispatch-slurm/squeue.go @@ -7,7 +7,6 @@ package main import ( "bytes" "fmt" - "log" "sort" "strings" "sync" @@ -27,6 +26,7 @@ type slurmJob struct { // Squeue implements asynchronous polling monitor of the SLURM queue using the // command 'squeue'. type SqueueChecker struct { + Logger logger Period time.Duration PrioritySpread int64 Slurm Slurm @@ -121,7 +121,7 @@ func (sqc *SqueueChecker) reniceAll() { } err := sqc.Slurm.Renice(job.uuid, niceNew) if err != nil && niceNew > slurm15NiceLimit && strings.Contains(err.Error(), "Invalid nice value") { - log.Printf("container %q clamping nice values at %d, priority order will not be correct -- see https://dev.arvados.org/projects/arvados/wiki/SLURM_integration#Limited-nice-values-SLURM-15", job.uuid, slurm15NiceLimit) + sqc.Logger.Warnf("container %q clamping nice values at %d, priority order will not be correct -- see https://dev.arvados.org/projects/arvados/wiki/SLURM_integration#Limited-nice-values-SLURM-15", job.uuid, slurm15NiceLimit) job.hitNiceLimit = true } } @@ -143,7 +143,7 @@ func (sqc *SqueueChecker) check() { stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{} cmd.Stdout, cmd.Stderr = stdout, stderr if err := cmd.Run(); err != nil { - log.Printf("Error running %q %q: %s %q", cmd.Path, cmd.Args, err, stderr.String()) + sqc.Logger.Warnf("Error running %q %q: %s %q", cmd.Path, cmd.Args, err, stderr.String()) return } @@ -156,7 +156,7 @@ func (sqc *SqueueChecker) check() { var uuid, state, reason string var n, p int64 if _, err := fmt.Sscan(line, &uuid, &n, &p, &state, &reason); err != nil { - log.Printf("warning: ignoring unparsed line in squeue output: %q", line) + sqc.Logger.Warnf("ignoring unparsed line in squeue output: %q", line) continue } @@ -192,10 +192,10 @@ func (sqc *SqueueChecker) check() { // "launch failed requeued held" seems to be // another manifestation of this problem, // resolved the same way. - log.Printf("releasing held job %q (priority=%d, state=%q, reason=%q)", uuid, p, state, reason) + sqc.Logger.Printf("releasing held job %q (priority=%d, state=%q, reason=%q)", uuid, p, state, reason) sqc.Slurm.Release(uuid) } else if state != "RUNNING" && p <= 2*slurm15NiceLimit && replacing.wantPriority > 0 { - log.Printf("warning: job %q has low priority %d, nice %d, state %q, reason %q", uuid, p, n, state, reason) + sqc.Logger.Warnf("job %q has low priority %d, nice %d, state %q, reason %q", uuid, p, n, state, reason) } } sqc.lock.Lock() diff --git a/services/crunch-dispatch-slurm/squeue_test.go b/services/crunch-dispatch-slurm/squeue_test.go index ef036dabd7..de674a1397 100644 --- a/services/crunch-dispatch-slurm/squeue_test.go +++ b/services/crunch-dispatch-slurm/squeue_test.go @@ -7,6 +7,7 @@ package main import ( "time" + "github.com/Sirupsen/logrus" . "gopkg.in/check.v1" ) @@ -24,6 +25,7 @@ func (s *SqueueSuite) TestReleasePending(c *C) { queue: uuids[0] + " 10000 4294000000 PENDING Resources\n" + uuids[1] + " 10000 4294000111 PENDING Resources\n" + uuids[2] + " 10000 0 PENDING BadConstraints\n", } sqc := &SqueueChecker{ + Logger: logrus.StandardLogger(), Slurm: slurm, Period: time.Hour, } @@ -88,6 +90,7 @@ func (s *SqueueSuite) TestReniceAll(c *C) { queue: test.squeue, } sqc := &SqueueChecker{ + Logger: logrus.StandardLogger(), Slurm: slurm, PrioritySpread: test.spread, Period: time.Hour, @@ -112,6 +115,7 @@ func (s *SqueueSuite) TestReniceInvalidNiceValue(c *C) { rejectNice10K: true, } sqc := &SqueueChecker{ + Logger: logrus.StandardLogger(), Slurm: slurm, PrioritySpread: 1, Period: time.Hour, @@ -155,6 +159,7 @@ func (s *SqueueSuite) TestSetPriorityBeforeQueued(c *C) { slurm := &slurmFake{} sqc := &SqueueChecker{ + Logger: logrus.StandardLogger(), Slurm: slurm, Period: time.Hour, }