Skip to content

Commit fbc4717

Browse files
committed
[core] Push LHC fill info, O2 start/end, run type, LHC period to tasks
1 parent f11ef3b commit fbc4717

4 files changed

Lines changed: 29 additions & 1 deletion

File tree

core/environment/transition_startactivity.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/AliceO2Group/Control/common/logger/infologger"
3333
"github.com/AliceO2Group/Control/core/controlcommands"
3434
"github.com/AliceO2Group/Control/core/task"
35+
"github.com/iancoleman/strcase"
3536
)
3637

3738
func NewStartActivityTransition(taskman *task.Manager) Transition {
@@ -73,6 +74,22 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
7374
"cleanup": strconv.Itoa(cleanupCount),
7475
}
7576

77+
// If bookkeeping is enabled and has fetched the LHC fill info, we can acquire it here
78+
for _, key := range []string{
79+
"fill_info_fill_number",
80+
"fill_info_filling_scheme",
81+
"fill_info_beam_type",
82+
"fill_info_stable_beam_start_ms",
83+
"fill_info_stable_beam_end_ms",
84+
"run_type",
85+
"run_start_time_ms",
86+
"lhc_period",
87+
} {
88+
if value, ok := env.GlobalVars.Get(key); ok {
89+
args[strcase.ToLowerCamel(key)] = value
90+
}
91+
}
92+
7693
taskmanMessage := task.NewTransitionTaskMessage(
7794
env.Workflow().GetTasks(),
7895
task.CONFIGURED.String(),

core/environment/transition_stopactivity.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ import (
2929

3030
"github.com/AliceO2Group/Control/common/event"
3131
"github.com/AliceO2Group/Control/common/logger/infologger"
32+
"github.com/AliceO2Group/Control/core/controlcommands"
3233
"github.com/AliceO2Group/Control/core/task"
3334
"github.com/AliceO2Group/Control/core/workflow"
35+
"github.com/iancoleman/strcase"
3436
)
3537

3638
func NewStopActivityTransition(taskman *task.Manager) Transition {
@@ -55,6 +57,13 @@ func (t StopActivityTransition) do(env *Environment) (err error) {
5557
WithField("partition", env.Id().String()).
5658
Info("stopping run")
5759

60+
args := controlcommands.PropertyMap{}
61+
62+
// Propagate run end time to all tasks
63+
if value, ok := env.GlobalVars.Get("run_end_time_ms"); ok {
64+
args[strcase.ToLowerCamel("run_end_time_ms")] = value
65+
}
66+
5867
taskmanMessage := task.NewTransitionTaskMessage(
5968
env.Workflow().GetTasks().Filtered(func(t *task.Task) bool {
6069
if pr, ok := t.GetParentRole().(workflow.Role); ok {
@@ -65,7 +74,7 @@ func (t StopActivityTransition) do(env *Environment) (err error) {
6574
task.RUNNING.String(),
6675
task.STOP.String(),
6776
task.CONFIGURED.String(),
68-
nil,
77+
args,
6978
env.Id(),
7079
)
7180
t.taskman.MessageChannel <- taskmanMessage

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ require (
101101
github.com/hashicorp/hcl v1.0.0 // indirect
102102
github.com/hashicorp/serf v0.9.8 // indirect
103103
github.com/huandu/xstrings v1.3.2 // indirect
104+
github.com/iancoleman/strcase v0.2.0 // indirect
104105
github.com/inconshreveable/mousetrap v1.0.0 // indirect
105106
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
106107
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4Dvx
329329
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
330330
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
331331
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
332+
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
332333
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
333334
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
334335
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=

0 commit comments

Comments
 (0)