Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main.go #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions cmd/cc-energy-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ import (
"sync"
"time"

// DB added
opt "github.com/ClusterCockpit/cc-energy-manager/pkg/Optimizer"
cclog "github.com/ClusterCockpit/cc-metric-collector/pkg/ccLogger"
lp "github.com/ClusterCockpit/cc-metric-collector/pkg/ccMetric"
)
Expand Down Expand Up @@ -73,8 +71,6 @@ type RuntimeConfig struct {
ReceiveManager receivers.ReceiveManager
// Router router.MetricRouter
ClustManager cmanager.ClusterManager
//DB
Optimizer opt.Optimizer

Channels []chan lp.CCMetric
Sync sync.WaitGroup
Expand Down Expand Up @@ -147,10 +143,6 @@ func shutdownHandler(config *RuntimeConfig, shutdownSignal chan os.Signal) {
cclog.Debug("Shutdown ClusterManager...")
config.ClustManager.Close()
}
if config.Optimizer != nil {
cclog.Debug("Shutdown Optimizer....")
config.Optimizer.Close()
}
}

func mainFunc() int {
Expand All @@ -161,8 +153,6 @@ func mainFunc() int {
SinkManager: nil,
ReceiveManager: nil,
// Router: nil,
// DB added an Optimer to rcfg
Optimizer: nil,
ClustManager: nil,
CliArgs: ReadCli(),
}
Expand Down Expand Up @@ -241,18 +231,11 @@ func mainFunc() int {
rcfg.ReceiveManager.AddOutput(ReceiversToRouterChannel)
rcfg.ClustManager.AddInput(ReceiversToRouterChannel)

// Optimizer
rcfg.Optimizer.AddInput(RouterToOptimizerChannel)
rcfg.Optimizer.AddOutput(OptimizerToSinksChannel)

// Start the managers
rcfg.SinkManager.Start()
rcfg.ReceiveManager.Start()
rcfg.ClustManager.Start()

// Start the Optimizer
rcfg.Optimizer.Start()

// Wait until one tick has passed. This is a workaround
if rcfg.CliArgs["once"] == "true" {
x := 1.2 * float64(rcfg.Interval.Seconds())
Expand Down