Skip to content

Commit

Permalink
[core] Handle daq & standalone trg reconciliation gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
kostorr committed Apr 14, 2022
1 parent 5b0c951 commit 58302c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions core/integration/trg/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,18 @@ func (p *Plugin) reconcile() {
}

if trgRun.State == CTP_RUNNING { // both STANDALONE and GLOBAL
if trgRun.Cardinality == CTP_STANDALONE { // if global run, we send no detector

// Setting the detector here results in a failed RunStop call
// Returns with RC:12 "Unknown ltud [DETNAME]"
/*if trgRun.Cardinality == CTP_STANDALONE { // if global run, we send no detector
if len(trgRun.Detectors) == 1 {
in.Detector = trgRun.Detectors[0].String()
}
}
}*/

ctx, _ := context.WithTimeout(context.Background(), TRG_RECONCILIATION_TIMEOUT)
_, err := p.trgClient.RunStop(ctx, &in, grpc.EmptyCallOption{})
// TODO: Response's RC should also be checked here
if err != nil {
err = fmt.Errorf("TRG reconciliation failure: %w", err)
log.WithError(err).
Expand Down
8 changes: 6 additions & 2 deletions core/integration/trg/trgutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Run struct {
RunNumber uint32
State State
Detectors []system.ID
Skip bool
}

type Runs []Run
Expand Down Expand Up @@ -75,7 +76,7 @@ const (
func parseRunList(runCount int, payload string) (runs Runs, err []error) {
cleanPayload := strings.TrimSpace(payload)
if len(cleanPayload) == 0 {
err = append(err, fmt.Errorf("empty RunList response payload"))
// nothing to do
return
}
lines := strings.Split(strings.TrimSpace(cleanPayload), "\n")
Expand All @@ -89,7 +90,9 @@ func parseRunList(runCount int, payload string) (runs Runs, err []error) {
err = append(err, fmt.Errorf("cannot parse line %d: %s", i, parseErr.Error()))
continue
}
runs = append(runs, run)
if !run.Skip {
runs = append(runs, run)
}
}

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

Expand Down

0 comments on commit 58302c1

Please sign in to comment.