@@ -45,6 +45,7 @@ import (
4545 "github.com/AliceO2Group/Control/core/workflow/callable"
4646 "github.com/spf13/viper"
4747 "google.golang.org/grpc"
48+ "google.golang.org/grpc/connectivity"
4849)
4950
5051const (
@@ -409,22 +410,22 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
409410 return
410411 }
411412
412- // if p.trgClient.GetConnState() != connectivity.Ready {
413- // err = fmt.Errorf("TRG client connection not available, RunLoad impossible")
414- //
415- // log.WithError(err).
416- // WithField("level", infologger.IL_Support).
417- // WithField("endpoint", viper.GetString("trgServiceEndpoint")).
418- // WithField("runNumber", runNumber64).
419- // WithField("partition", envId).
420- // WithField("call", "RunLoad").
421- // Error("TRG error")
422- //
423- // call.VarStack["__call_error_reason"] = err.Error()
424- // call.VarStack["__call_error"] = callFailedStr
425- //
426- // return
427- // }
413+ if p .trgClient .GetConnState () == connectivity .Shutdown {
414+ err = fmt .Errorf ("TRG client connection not available, RunLoad impossible" )
415+
416+ log .WithError (err ).
417+ WithField ("level" , infologger .IL_Support ).
418+ WithField ("endpoint" , viper .GetString ("trgServiceEndpoint" )).
419+ WithField ("runNumber" , runNumber64 ).
420+ WithField ("partition" , envId ).
421+ WithField ("call" , "RunLoad" ).
422+ Error ("TRG error" )
423+
424+ call .VarStack ["__call_error_reason" ] = err .Error ()
425+ call .VarStack ["__call_error" ] = callFailedStr
426+
427+ return
428+ }
428429
429430 var response * trgpb.RunReply
430431 response , err = p .trgClient .RunLoad (context .Background (), & in , grpc.EmptyCallOption {})
@@ -545,22 +546,22 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
545546
546547 return
547548 }
548- // if p.trgClient.GetConnState() != connectivity.Ready {
549- // err = fmt.Errorf("TRG client connection not available, RunStart impossible")
550- //
551- // log.WithError(err).
552- // WithField("level", infologger.IL_Support).
553- // WithField("endpoint", viper.GetString("trgServiceEndpoint")).
554- // WithField("runNumber", runNumber64).
555- // WithField("partition", envId).
556- // WithField("call", "RunStart").
557- // Error("TRG error")
558- //
559- // call.VarStack["__call_error_reason"] = err.Error()
560- // call.VarStack["__call_error"] = callFailedStr
561- //
562- // return
563- // }
549+ if p .trgClient .GetConnState () == connectivity .Shutdown {
550+ err = fmt .Errorf ("TRG client connection not available, RunStart impossible" )
551+
552+ log .WithError (err ).
553+ WithField ("level" , infologger .IL_Support ).
554+ WithField ("endpoint" , viper .GetString ("trgServiceEndpoint" )).
555+ WithField ("runNumber" , runNumber64 ).
556+ WithField ("partition" , envId ).
557+ WithField ("call" , "RunStart" ).
558+ Error ("TRG error" )
559+
560+ call .VarStack ["__call_error_reason" ] = err .Error ()
561+ call .VarStack ["__call_error" ] = callFailedStr
562+
563+ return
564+ }
564565
565566 var response * trgpb.RunReply
566567
@@ -657,22 +658,22 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
657658
658659 return
659660 }
660- // if p.trgClient.GetConnState() != connectivity.Ready {
661- // err = fmt.Errorf("TRG client connection not available, RunStop impossible")
662- //
663- // log.WithError(err).
664- // WithField("level", infologger.IL_Support).
665- // WithField("endpoint", viper.GetString("trgServiceEndpoint")).
666- // WithField("runNumber", runNumber64).
667- // WithField("partition", envId).
668- // WithField("call", "RunStop").
669- // Error("TRG error")
670- //
671- // call.VarStack["__call_error_reason"] = err.Error()
672- // call.VarStack["__call_error"] = callFailedStr
673- //
674- // return
675- // }
661+ if p .trgClient .GetConnState () == connectivity .Shutdown {
662+ err = fmt .Errorf ("TRG client connection not available, RunStop impossible" )
663+
664+ log .WithError (err ).
665+ WithField ("level" , infologger .IL_Support ).
666+ WithField ("endpoint" , viper .GetString ("trgServiceEndpoint" )).
667+ WithField ("runNumber" , runNumber64 ).
668+ WithField ("partition" , envId ).
669+ WithField ("call" , "RunStop" ).
670+ Error ("TRG error" )
671+
672+ call .VarStack ["__call_error_reason" ] = err .Error ()
673+ call .VarStack ["__call_error" ] = callFailedStr
674+
675+ return
676+ }
676677
677678 var response * trgpb.RunReply
678679 response , err = p .trgClient .RunStop (context .Background (), & in , grpc.EmptyCallOption {})
@@ -772,22 +773,22 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
772773
773774 return
774775 }
775- // if p.trgClient.GetConnState() != connectivity.Ready {
776- // err = fmt.Errorf("TRG client connection not available, RunUnload impossible")
777- //
778- // log.WithError(err).
779- // WithField("level", infologger.IL_Support).
780- // WithField("endpoint", viper.GetString("trgServiceEndpoint")).
781- // WithField("runNumber", runNumber64).
782- // WithField("partition", envId).
783- // WithField("call", "RunUnload").
784- // Error("TRG error")
785- //
786- // call.VarStack["__call_error_reason"] = err.Error()
787- // call.VarStack["__call_error"] = callFailedStr
788- //
789- // return
790- // }
776+ if p .trgClient .GetConnState () == connectivity .Shutdown {
777+ err = fmt .Errorf ("TRG client connection not available, RunUnload impossible" )
778+
779+ log .WithError (err ).
780+ WithField ("level" , infologger .IL_Support ).
781+ WithField ("endpoint" , viper .GetString ("trgServiceEndpoint" )).
782+ WithField ("runNumber" , runNumber64 ).
783+ WithField ("partition" , envId ).
784+ WithField ("call" , "RunUnload" ).
785+ Error ("TRG error" )
786+
787+ call .VarStack ["__call_error_reason" ] = err .Error ()
788+ call .VarStack ["__call_error" ] = callFailedStr
789+
790+ return
791+ }
791792
792793 var response * trgpb.RunReply
793794 response , err = p .trgClient .RunUnload (context .Background (), & in , grpc.EmptyCallOption {})
0 commit comments