[ARVADOS] updated: e5e9ae2751cf691c7eeee60eac9d70e4f1e57a3b

Git user git at public.curoverse.com
Fri Aug 5 11:01:06 EDT 2016


Summary of changes:
 .../crunch-dispatch-slurm/crunch-dispatch-slurm.go | 16 ++++++-------
 services/crunch-dispatch-slurm/usage.go            | 28 ++++++++++++++++++++++
 2 files changed, 36 insertions(+), 8 deletions(-)
 create mode 100644 services/crunch-dispatch-slurm/usage.go

       via  e5e9ae2751cf691c7eeee60eac9d70e4f1e57a3b (commit)
      from  c1307df1b44856448b9dc64000cd5cd1befb2b14 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e5e9ae2751cf691c7eeee60eac9d70e4f1e57a3b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Aug 5 10:54:37 2016 -0400

    9706: Add example config file.
    
    No issue #

diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
index af2c42e..b11963c 100644
--- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
+++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
@@ -22,7 +22,7 @@ import (
 // Config used by crunch-dispatch-slurm
 type Config struct {
 	SbatchArguments []string
-	PollPeriod      *time.Duration
+	PollPeriod      arvados.Duration
 
 	// crunch-run command to invoke. The container UUID will be
 	// appended. If nil, []string{"crunch-run"} will be used.
@@ -47,17 +47,13 @@ const defaultConfigPath = "/etc/arvados/crunch-dispatch-slurm/config.json"
 
 func doMain() error {
 	flags := flag.NewFlagSet("crunch-dispatch-slurm", flag.ExitOnError)
+	flags.Usage = func() { usage(flags) }
 
 	configPath := flags.String(
 		"config",
 		defaultConfigPath,
 		"`path` to json configuration file")
 
-	config.PollPeriod = flags.Duration(
-		"poll-interval",
-		10*time.Second,
-		"Time duration to poll for queued containers")
-
 	// Parse args; omit the first arg which is the command name
 	flags.Parse(os.Args[1:])
 
@@ -71,6 +67,10 @@ func doMain() error {
 		config.CrunchRunCommand = []string{"crunch-run"}
 	}
 
+	if config.PollPeriod == 0 {
+		config.PollPeriod = arvados.Duration(10 * time.Second)
+	}
+
 	arv, err := arvadosclient.MakeArvadosClient()
 	if err != nil {
 		log.Printf("Error making Arvados client: %v", err)
@@ -78,13 +78,13 @@ func doMain() error {
 	}
 	arv.Retries = 25
 
-	squeueUpdater.StartMonitor(*config.PollPeriod)
+	squeueUpdater.StartMonitor(time.Duration(config.PollPeriod))
 	defer squeueUpdater.Done()
 
 	dispatcher := dispatch.Dispatcher{
 		Arv:            arv,
 		RunContainer:   run,
-		PollInterval:   *config.PollPeriod,
+		PollInterval:   time.Duration(config.PollPeriod),
 		DoneProcessing: make(chan struct{})}
 
 	err = dispatcher.RunDispatcher()
diff --git a/services/crunch-dispatch-slurm/usage.go b/services/crunch-dispatch-slurm/usage.go
new file mode 100644
index 0000000..683ff76
--- /dev/null
+++ b/services/crunch-dispatch-slurm/usage.go
@@ -0,0 +1,28 @@
+package main
+
+import (
+	"flag"
+	"fmt"
+	"os"
+)
+
+var exampleConfigFile = []byte(`
+    {
+	"CrunchRunCommand": ["crunch-run"],
+	"PollPeriod": "10s",
+	"SbatchArguments": ["--partition=foo", "--exclude=node13"]
+    }`)
+
+func usage(fs *flag.FlagSet) {
+	fmt.Fprintf(os.Stderr, `
+crunch-dispatch-slurm runs queued Arvados containers by submitting
+SLURM batch jobs.
+
+Options:
+`)
+	fs.PrintDefaults()
+	fmt.Fprintf(os.Stderr, `
+Example config file:
+%s
+`, exampleConfigFile)
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list