diff options
Diffstat (limited to 'cmd/bookpipeline/main.go')
-rw-r--r-- | cmd/bookpipeline/main.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cmd/bookpipeline/main.go b/cmd/bookpipeline/main.go index 3f55def..f5025ac 100644 --- a/cmd/bookpipeline/main.go +++ b/cmd/bookpipeline/main.go @@ -25,7 +25,7 @@ import ( "rescribe.xyz/utils/pkg/hocr" ) -const usage = `Usage: bookpipeline [-v] [-np] [-nw] [-nop] [-na] [-t training] [-shutdown true/false] +const usage = `Usage: bookpipeline [-v] [-c conn] [-np] [-nw] [-nop] [-na] [-t training] [-shutdown true/false] Watches the preprocess, wipeonly, ocrpage and analyse queues for messages. When one is found this general process is followed: @@ -723,6 +723,7 @@ func main() { noocrpg := flag.Bool("nop", false, "disable ocr on individual pages") noanalyse := flag.Bool("na", false, "disable analysis") autoshutdown := flag.Bool("shutdown", false, "automatically shut down if no work has been available for 5 minutes") + conntype := flag.String("c", "aws", "connection type ('aws' or 'local')") flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), usage) @@ -743,7 +744,14 @@ func main() { ocredPattern := regexp.MustCompile(`.hocr$`) var conn Pipeliner - conn = &bookpipeline.AwsConn{Region: "eu-west-2", Logger: verboselog} + switch *conntype { + case "aws": + conn = &bookpipeline.AwsConn{Region: "eu-west-2", Logger: verboselog} + case "local": + conn = &bookpipeline.LocalConn{Logger: verboselog} + default: + log.Fatalln("Unknown connection type") + } conn.Log("Setting up AWS session") err := conn.Init() @@ -773,9 +781,7 @@ func main() { if !*noanalyse { checkAnalyseQueue = time.After(0) } - if *autoshutdown { - shutdownIfQuiet = time.NewTimer(TimeBeforeShutdown) - } + shutdownIfQuiet = time.NewTimer(TimeBeforeShutdown) savelognow = time.NewTicker(LogSaveTime) for { |