Skip to content

Commit 1200e8a

Browse files
miltalexteo
authored andcommitted
[core] Pass detectors to Bookkeeping API
1 parent 710bf86 commit 1200e8a

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

core/bookkeeping/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ var (
5252

5353
func Instance() *BookkeepingWrapper {
5454
once.Do(func() {
55-
apiUrl, err := url.Parse(viper.GetString("bookkeepingBaseUri"))
55+
apiUrl, err := url.Parse(viper.GetString("bookkeepingBaseUri"))
5656
if err == nil {
57-
apiUrl.Path = path.Join( apiUrl.Path + "api")
57+
apiUrl.Path = path.Join(apiUrl.Path + "api")
5858
clientAPI.InitializeApi(apiUrl.String(), viper.GetString("bookkeepingToken"))
5959
} else {
6060
log.WithField("error", err.Error()).
61-
Error("unable to parse the Bookkeeping base URL")
61+
Error("unable to parse the Bookkeeping base URL")
6262
clientAPI.InitializeApi(path.Join(viper.GetString("bookkeepingBaseUri")+"api"), viper.GetString("bookkeepingToken"))
6363
}
6464
})
6565
return instance
6666
}
6767

68-
func (bk *BookkeepingWrapper) CreateRun(activityId string, nDetectors int, nEpns int, nFlps int, runNumber int32, runType string, timeO2Start time.Time, timeTrgStart time.Time, dd_flp bool, dcs bool, epn bool, epnTopology string) {
68+
func (bk *BookkeepingWrapper) CreateRun(activityId string, nDetectors int, nEpns int, nFlps int, runNumber int32, runType string, timeO2Start time.Time, timeTrgStart time.Time, dd_flp bool, dcs bool, epn bool, epnTopology string, detectors string) {
6969
var runtypeAPI sw.RunType
7070
switch runType {
7171
case string(sw.TECHNICAL_RunType):
@@ -79,7 +79,7 @@ func (bk *BookkeepingWrapper) CreateRun(activityId string, nDetectors int, nEpns
7979
runtypeAPI = sw.TECHNICAL_RunType
8080
}
8181

82-
clientAPI.CreateRun(activityId, int32(nDetectors), int32(nEpns), int32(nFlps), runNumber, runtypeAPI, timeO2Start, timeTrgStart, dd_flp, dcs, epn, epnTopology)
82+
clientAPI.CreateRun(activityId, int32(nDetectors), int32(nEpns), int32(nFlps), runNumber, runtypeAPI, timeO2Start, timeTrgStart, dd_flp, dcs, epn, epnTopology, sw.Detectors(detectors))
8383
}
8484

8585
func (bk *BookkeepingWrapper) UpdateRun(runNumber int32, runResult string, timeO2End time.Time, timeTrgEnd time.Time) {

core/environment/transition_startactivity.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"errors"
2929
"fmt"
3030
"strconv"
31+
"strings"
3132
"time"
3233

3334
"github.com/AliceO2Group/Control/common/event"
@@ -66,11 +67,13 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
6667
}
6768

6869
flps := env.GetFLPs()
69-
dd_enabled, _ := strconv.ParseBool(env.GetKV("","dd_enabled"))
70-
dcs_enabled, _ := strconv.ParseBool(env.GetKV("","dcs_enabled"))
71-
epn_enabled, _ := strconv.ParseBool(env.GetKV("","epn_enabled"))
72-
odc_topology := env.GetKV("","odc_topology")
73-
the.BookkeepingAPI().CreateRun(env.Id().String(), len(env.GetActiveDetectors()), 0, len(flps), int32(runNumber), env.GetRunType().String(), time.Now(), time.Now(), dd_enabled, dcs_enabled, epn_enabled, odc_topology)
70+
dd_enabled, _ := strconv.ParseBool(env.GetKV("", "dd_enabled"))
71+
dcs_enabled, _ := strconv.ParseBool(env.GetKV("", "dcs_enabled"))
72+
epn_enabled, _ := strconv.ParseBool(env.GetKV("", "epn_enabled"))
73+
odc_topology := env.GetKV("", "odc_topology")
74+
// GetString of active detectors and pass it to the BK API
75+
detectors := strings.Join(env.GetActiveDetectors().StringList(), ",")
76+
the.BookkeepingAPI().CreateRun(env.Id().String(), len(env.GetActiveDetectors()), 0, len(flps), int32(runNumber), env.GetRunType().String(), time.Now(), time.Now(), dd_enabled, dcs_enabled, epn_enabled, odc_topology, detectors)
7477
for _, flp := range flps {
7578
the.BookkeepingAPI().CreateFlp(flp, flp, int32(runNumber))
7679
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ require (
2020
cloud.google.com/go v0.76.0 // indirect
2121
cloud.google.com/go/firestore v1.4.0 // indirect
2222
github.com/AlecAivazis/survey/v2 v2.2.7
23-
github.com/AliceO2Group/Bookkeeping v0.17.7 // indirect
24-
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210924092906-25a559aecc82
23+
github.com/AliceO2Group/Bookkeeping v0.17.11 // indirect
24+
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20211008112908-4cf8d3c04b18
2525
github.com/BurntSushi/xgb v0.0.0-20210121224620-deaf085860bc // indirect
2626
github.com/Masterminds/goutils v1.1.1 // indirect
2727
github.com/Masterminds/semver v1.5.0 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ github.com/AliceO2Group/Bookkeeping v0.17.6 h1:O6D3wr5+twn0JQHiSz5+4TWdhNmWFYqxx
8989
github.com/AliceO2Group/Bookkeeping v0.17.6/go.mod h1:Ig2ePkJuGnTF9NH+f8f1h5A8yGIuWowPHBlpQHn/0NU=
9090
github.com/AliceO2Group/Bookkeeping v0.17.7 h1:22Mb6Hdp9tZ3z8QeAjm81S4HiLaNLBVZ5Mn3TWRSQqI=
9191
github.com/AliceO2Group/Bookkeeping v0.17.7/go.mod h1:Ig2ePkJuGnTF9NH+f8f1h5A8yGIuWowPHBlpQHn/0NU=
92+
github.com/AliceO2Group/Bookkeeping v0.17.11 h1:Ktmua360dZEaLSbD4z1pfXVGnVa7x6b8hKsog+PLH50=
93+
github.com/AliceO2Group/Bookkeeping v0.17.11/go.mod h1:Ig2ePkJuGnTF9NH+f8f1h5A8yGIuWowPHBlpQHn/0NU=
9294
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210308150404-e78be0de914f h1:s8o3xu0+3TrjYuRypa5C4XyLOIpoLxupdnS5z2LetDU=
9395
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210308150404-e78be0de914f/go.mod h1:w64yucnc/ncO+KGk26OY4Uhy+Vf/WAbU85ZfunlN7XM=
9496
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210409104827-fd1b74c641ba h1:hbiftnpE/yrRFcuuo2DGOtLhcyy1SFer1cWLS/GWG00=
@@ -99,6 +101,8 @@ github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210917100552-e0d4d674
99101
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210917100552-e0d4d674fe89/go.mod h1:w64yucnc/ncO+KGk26OY4Uhy+Vf/WAbU85ZfunlN7XM=
100102
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210924092906-25a559aecc82 h1:2qYbJeWSSpG5cr7usLewzNaC3f7czW1of4uoHLoeXyY=
101103
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20210924092906-25a559aecc82/go.mod h1:w64yucnc/ncO+KGk26OY4Uhy+Vf/WAbU85ZfunlN7XM=
104+
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20211008112908-4cf8d3c04b18 h1:f20KwRKWuJgZtXDrTvKUreQLACfDeqmpwLi/xD45b3g=
105+
github.com/AliceO2Group/Bookkeeping/go-api-client v0.0.0-20211008112908-4cf8d3c04b18/go.mod h1:w64yucnc/ncO+KGk26OY4Uhy+Vf/WAbU85ZfunlN7XM=
102106
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
103107
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
104108
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=

0 commit comments

Comments
 (0)