Skip to content

Commit ffcd960

Browse files
knopers8teo
authored andcommitted
[core] use the parent role to propagate lhc info to the whole env
1 parent 7e7e58a commit ffcd960

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

core/integration/bookkeeping/plugin.go

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,14 +1318,23 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
13181318
}
13191319

13201320
propagateLHCInfoToVarStack := func(lhcInfo *bkpb.LHCFill, varStack map[string]string) {
1321-
call.VarStack["fill_info_fill_number"] = string(lhcInfo.FillNumber)
1322-
call.VarStack["fill_info_filling_scheme"] = lhcInfo.FillingSchemeName
1323-
call.VarStack["fill_info_beam_type"] = lhcInfo.BeamType
1321+
parentRole, ok := call.GetParentRole().(callable.ParentRole)
1322+
if !ok {
1323+
log.WithField("partition", envId).
1324+
WithField("level", infologger.IL_Devel).
1325+
WithField("endpoint", viper.GetString("bookkeepingBaseUri")).
1326+
WithField("call", "RetrieveFillInfo").
1327+
Errorf("could not access the parent role when trying to propagate the LHC fill info")
1328+
return
1329+
}
1330+
parentRole.SetGlobalRuntimeVar("fill_info_fill_number", string(lhcInfo.FillNumber))
1331+
parentRole.SetGlobalRuntimeVar("fill_info_filling_scheme", lhcInfo.FillingSchemeName)
1332+
parentRole.SetGlobalRuntimeVar("fill_info_beam_type", lhcInfo.BeamType)
13241333
if lhcInfo.StableBeamStart != nil {
1325-
call.VarStack["fill_info_stable_beam_start_ms"] = strconv.FormatInt(*lhcInfo.StableBeamStart, 10)
1334+
parentRole.SetGlobalRuntimeVar("fill_info_stable_beam_start_ms", strconv.FormatInt(*lhcInfo.StableBeamStart, 10))
13261335
}
13271336
if lhcInfo.StableBeamEnd != nil {
1328-
call.VarStack["fill_info_stable_beam_end_ms"] = strconv.FormatInt(*lhcInfo.StableBeamEnd, 10)
1337+
parentRole.SetGlobalRuntimeVar("fill_info_stable_beam_end_ms", strconv.FormatInt(*lhcInfo.StableBeamEnd, 10))
13291338
}
13301339
log.WithField("partition", envId).
13311340
WithField("level", infologger.IL_Devel).
@@ -1335,11 +1344,20 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
13351344
lhcInfo.FillNumber, lhcInfo.FillingSchemeName, lhcInfo.BeamType)
13361345
}
13371346
deleteLHCInfoInVarStack := func(varStack map[string]string) {
1338-
delete(call.VarStack, "fill_info_fill_number")
1339-
delete(call.VarStack, "fill_info_filling_scheme")
1340-
delete(call.VarStack, "fill_info_beam_type")
1341-
delete(call.VarStack, "fill_info_stable_beam_start_ms")
1342-
delete(call.VarStack, "fill_info_stable_beam_end_ms")
1347+
parentRole, ok := call.GetParentRole().(callable.ParentRole)
1348+
if !ok {
1349+
log.WithField("partition", envId).
1350+
WithField("level", infologger.IL_Devel).
1351+
WithField("endpoint", viper.GetString("bookkeepingBaseUri")).
1352+
WithField("call", "RetrieveFillInfo").
1353+
Errorf("could not access the parent role when trying to clean up LHC fill info")
1354+
return
1355+
}
1356+
parentRole.DeleteGlobalRuntimeVar("fill_info_fill_number")
1357+
parentRole.DeleteGlobalRuntimeVar("fill_info_filling_scheme")
1358+
parentRole.DeleteGlobalRuntimeVar("fill_info_beam_type")
1359+
parentRole.DeleteGlobalRuntimeVar("fill_info_stable_beam_start_ms")
1360+
parentRole.DeleteGlobalRuntimeVar("fill_info_stable_beam_end_ms")
13431361
}
13441362

13451363
stack["RetrieveFillInfo"] = func() (out string) {

0 commit comments

Comments
 (0)