From 97941d4092d24064ef553f295111a95198d409fa Mon Sep 17 00:00:00 2001 From: potsables Date: Sat, 23 Feb 2019 03:52:36 -0800 Subject: [PATCH 1/6] cmd/temporal-lens: fix engine opts to include store path --- cmd/temporal-lens/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/temporal-lens/main.go b/cmd/temporal-lens/main.go index 31ca867..2f6303b 100644 --- a/cmd/temporal-lens/main.go +++ b/cmd/temporal-lens/main.go @@ -11,6 +11,7 @@ import ( lens "github.com/RTradeLtd/Lens" "github.com/RTradeLtd/Lens/analyzer/images" + "github.com/RTradeLtd/Lens/engine" "github.com/RTradeLtd/Lens/logs" "github.com/RTradeLtd/Lens/server" "github.com/RTradeLtd/cmd" @@ -68,7 +69,7 @@ var commands = map[string]cmd.Cmd{ // create lens v2 service l.Info("instantiating Lens V2") - srv, err := lens.NewV2(lens.V2Options{}, manager, tf, l) + srv, err := lens.NewV2(lens.V2Options{Engine: engine.Opts{StorePath: *dsPath}}, manager, tf, l) if err != nil { l.Fatalw("failed to instantiate Lens V2", "error", err) } From 0721770cc5d9f53e27534ae562807062840a45a5 Mon Sep 17 00:00:00 2001 From: potsables Date: Sat, 23 Feb 2019 04:24:26 -0800 Subject: [PATCH 2/6] cmd/temporal-lens: fix missing engine opts --- cmd/temporal-lens/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/temporal-lens/main.go b/cmd/temporal-lens/main.go index 2f6303b..bfc00dd 100644 --- a/cmd/temporal-lens/main.go +++ b/cmd/temporal-lens/main.go @@ -12,6 +12,7 @@ import ( lens "github.com/RTradeLtd/Lens" "github.com/RTradeLtd/Lens/analyzer/images" "github.com/RTradeLtd/Lens/engine" + "github.com/RTradeLtd/Lens/engine/queue" "github.com/RTradeLtd/Lens/logs" "github.com/RTradeLtd/Lens/server" "github.com/RTradeLtd/cmd" @@ -69,7 +70,15 @@ var commands = map[string]cmd.Cmd{ // create lens v2 service l.Info("instantiating Lens V2") - srv, err := lens.NewV2(lens.V2Options{Engine: engine.Opts{StorePath: *dsPath}}, manager, tf, l) + srv, err := lens.NewV2(lens.V2Options{ + Engine: engine.Opts{ + StorePath: *dsPath, + Queue: queue.Options{ + Rate: 500 * time.Millisecond, + BatchSize: 1, + }, + }, + }, manager, tf, l) if err != nil { l.Fatalw("failed to instantiate Lens V2", "error", err) } From b815a5c18e16ee0da4950596c20df8d56d9be623 Mon Sep 17 00:00:00 2001 From: potsables Date: Sat, 23 Feb 2019 23:54:10 -0800 Subject: [PATCH 3/6] deps: update config --- Gopkg.lock | 6 +++--- Gopkg.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index c5ac388..b43a598 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -26,12 +26,12 @@ version = "v1.0.4" [[projects]] - branch = "master" - digest = "1:6745d03b8fe80de8662ec3f838a28731cf3b7ed85cc6959c1f765bab711c322d" + branch = "lens/opts#queue" + digest = "1:8668b739aab67e72ddd4890b3976e7a94e31488a3d1f7750abfeacdea5fe72f3" name = "github.com/RTradeLtd/config" packages = ["."] pruneopts = "T" - revision = "8a4af7437b526a027348bdbc2530f93bf5efd424" + revision = "064b7ed9c3bef449a6989abf6f191f6dbc899717" [[projects]] digest = "1:a05f942064ec8f597114935de279d334456cb5540a3aec871c51351b09ee4cdc" diff --git a/Gopkg.toml b/Gopkg.toml index b1df96b..3b87135 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -21,7 +21,7 @@ ignored = ["github.com/gen2brain/go-fitz"] [[constraint]] name = "github.com/RTradeLtd/config" - branch = "master" + branch = "lens/opts#queue" ############### # THIRD PARTY # From d629aea9bb9770a9ee2ff507afce2591a0c929bf Mon Sep 17 00:00:00 2001 From: potsables Date: Sat, 23 Feb 2019 23:54:23 -0800 Subject: [PATCH 4/6] cmd/temporal-lens: use config to control v2 server opts --- cmd/temporal-lens/main.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd/temporal-lens/main.go b/cmd/temporal-lens/main.go index bfc00dd..5b39410 100644 --- a/cmd/temporal-lens/main.go +++ b/cmd/temporal-lens/main.go @@ -6,6 +6,7 @@ import ( "log" "os" "os/signal" + "strconv" "syscall" "time" @@ -32,8 +33,6 @@ var ( "path to Temporal configuration") modelPath = flag.String("models", "/tmp", "path to TensorFlow models") - dsPath = flag.String("datastore", "/data/lens/badgerds-lens", - "path to Badger datastore") logPath = flag.String("logpath", "", "path to write logs to - leave blank for stdout") devMode = flag.Bool("dev", false, @@ -68,14 +67,23 @@ var commands = map[string]cmd.Cmd{ l.Fatalw("failed to instantiate image analyzer", "error", err) } + rateInt, err := strconv.ParseInt(cfg.Lens.Options.Queue.Rate, 10, 64) + if err != nil { + l.Fatalw("failed to parse rate to integer", "error", err) + } + batchInt, err := strconv.ParseInt(cfg.Lens.Options.Queue.Batch, 10, 64) + if err != nil { + l.Fatalw("failed to parse batch to integer", "error", err) + } + // create lens v2 service l.Info("instantiating Lens V2") srv, err := lens.NewV2(lens.V2Options{ Engine: engine.Opts{ - StorePath: *dsPath, + StorePath: cfg.Lens.Options.Engine.StorePath, Queue: queue.Options{ - Rate: 500 * time.Millisecond, - BatchSize: 1, + Rate: time.Duration(rateInt) * time.Second, + BatchSize: int(batchInt), }, }, }, manager, tf, l) From 414cf6854b0a6942f86e41e0b29a71dec3ae0fc9 Mon Sep 17 00:00:00 2001 From: potsables Date: Sun, 24 Feb 2019 01:10:10 -0800 Subject: [PATCH 5/6] cmd/temporal-lens: remove type conversions --- Gopkg.lock | 4 ++-- cmd/temporal-lens/main.go | 14 ++------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index b43a598..ce9cf0c 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -27,11 +27,11 @@ [[projects]] branch = "lens/opts#queue" - digest = "1:8668b739aab67e72ddd4890b3976e7a94e31488a3d1f7750abfeacdea5fe72f3" + digest = "1:bde6e5a9cb11741ce5dd34851590bbae178ae232a3bc605b459154fa03dfa183" name = "github.com/RTradeLtd/config" packages = ["."] pruneopts = "T" - revision = "064b7ed9c3bef449a6989abf6f191f6dbc899717" + revision = "db743af86b73ac68c1001443ea8a790d57975752" [[projects]] digest = "1:a05f942064ec8f597114935de279d334456cb5540a3aec871c51351b09ee4cdc" diff --git a/cmd/temporal-lens/main.go b/cmd/temporal-lens/main.go index 5b39410..66839d1 100644 --- a/cmd/temporal-lens/main.go +++ b/cmd/temporal-lens/main.go @@ -6,7 +6,6 @@ import ( "log" "os" "os/signal" - "strconv" "syscall" "time" @@ -67,23 +66,14 @@ var commands = map[string]cmd.Cmd{ l.Fatalw("failed to instantiate image analyzer", "error", err) } - rateInt, err := strconv.ParseInt(cfg.Lens.Options.Queue.Rate, 10, 64) - if err != nil { - l.Fatalw("failed to parse rate to integer", "error", err) - } - batchInt, err := strconv.ParseInt(cfg.Lens.Options.Queue.Batch, 10, 64) - if err != nil { - l.Fatalw("failed to parse batch to integer", "error", err) - } - // create lens v2 service l.Info("instantiating Lens V2") srv, err := lens.NewV2(lens.V2Options{ Engine: engine.Opts{ StorePath: cfg.Lens.Options.Engine.StorePath, Queue: queue.Options{ - Rate: time.Duration(rateInt) * time.Second, - BatchSize: int(batchInt), + Rate: time.Duration(cfg.Lens.Options.Engine.Queue.Rate) * time.Second, + BatchSize: cfg.Lens.Options.Engine.Queue.Batch, }, }, }, manager, tf, l) From 9c71f4bc48f7b10243d72dc89ee8ee7ad6decaae Mon Sep 17 00:00:00 2001 From: potsables Date: Sun, 24 Feb 2019 02:13:51 -0800 Subject: [PATCH 6/6] deps: adjust config to ~v2.0.0 --- Gopkg.lock | 4 ++-- Gopkg.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index ce9cf0c..7b9030e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -26,12 +26,12 @@ version = "v1.0.4" [[projects]] - branch = "lens/opts#queue" digest = "1:bde6e5a9cb11741ce5dd34851590bbae178ae232a3bc605b459154fa03dfa183" name = "github.com/RTradeLtd/config" packages = ["."] pruneopts = "T" - revision = "db743af86b73ac68c1001443ea8a790d57975752" + revision = "4140b3d6ec5751c110f0660a52b1b3209b95ddd6" + version = "v2.0.3" [[projects]] digest = "1:a05f942064ec8f597114935de279d334456cb5540a3aec871c51351b09ee4cdc" diff --git a/Gopkg.toml b/Gopkg.toml index 3b87135..4596f05 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -21,7 +21,7 @@ ignored = ["github.com/gen2brain/go-fitz"] [[constraint]] name = "github.com/RTradeLtd/config" - branch = "lens/opts#queue" + version = "~v2.0.0" ############### # THIRD PARTY #