Skip to content

Commit ba42bf2

Browse files
kostorrteo
authored andcommitted
[core] Handle daq & standalone trg reconciliation gracefully
1 parent 1315510 commit ba42bf2

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

core/integration/trg/plugin.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,18 @@ func (p *Plugin) reconcile() {
248248
}
249249

250250
if trgRun.State == CTP_RUNNING { // both STANDALONE and GLOBAL
251-
if trgRun.Cardinality == CTP_STANDALONE { // if global run, we send no detector
251+
252+
// Setting the detector here results in a failed RunStop call
253+
// Returns with RC:12 "Unknown ltud [DETNAME]"
254+
/*if trgRun.Cardinality == CTP_STANDALONE { // if global run, we send no detector
252255
if len(trgRun.Detectors) == 1 {
253256
in.Detector = trgRun.Detectors[0].String()
254257
}
255-
}
258+
}*/
259+
256260
ctx, _ := context.WithTimeout(context.Background(), TRG_RECONCILIATION_TIMEOUT)
257261
_, err := p.trgClient.RunStop(ctx, &in, grpc.EmptyCallOption{})
262+
// TODO: Response's RC should also be checked here
258263
if err != nil {
259264
err = fmt.Errorf("TRG reconciliation failure: %w", err)
260265
log.WithError(err).

core/integration/trg/trgutil.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type Run struct {
3737
RunNumber uint32
3838
State State
3939
Detectors []system.ID
40+
Skip bool
4041
}
4142

4243
type Runs []Run
@@ -75,7 +76,7 @@ const (
7576
func parseRunList(runCount int, payload string) (runs Runs, err []error) {
7677
cleanPayload := strings.TrimSpace(payload)
7778
if len(cleanPayload) == 0 {
78-
err = append(err, fmt.Errorf("empty RunList response payload"))
79+
// nothing to do
7980
return
8081
}
8182
lines := strings.Split(strings.TrimSpace(cleanPayload), "\n")
@@ -89,7 +90,9 @@ func parseRunList(runCount int, payload string) (runs Runs, err []error) {
8990
err = append(err, fmt.Errorf("cannot parse line %d: %s", i, parseErr.Error()))
9091
continue
9192
}
92-
runs = append(runs, run)
93+
if !run.Skip {
94+
runs = append(runs, run)
95+
}
9396
}
9497

9598
return
@@ -143,6 +146,7 @@ func parseRunLine(line string) (run Run, err error) {
143146
// don't interfere with daq
144147
// also daq not in known system ids -> results in error
145148
if strings.TrimSpace(item) == "daq" {
149+
run.Skip = true
146150
continue
147151
}
148152

0 commit comments

Comments
 (0)