@@ -40,10 +40,10 @@ import (
4040
4141 "github.com/AliceO2Group/Control/common"
4242 "github.com/AliceO2Group/Control/common/controlmode"
43+ "github.com/AliceO2Group/Control/common/event"
4344 "github.com/AliceO2Group/Control/common/gera"
4445 "github.com/AliceO2Group/Control/common/logger"
4546 "github.com/AliceO2Group/Control/common/utils"
46- "github.com/AliceO2Group/Control/common/event"
4747 "github.com/AliceO2Group/Control/common/utils/uid"
4848 "github.com/AliceO2Group/Control/configuration/template"
4949 "github.com/AliceO2Group/Control/core/controlcommands"
@@ -247,6 +247,7 @@ func (t *Task) BuildTaskCommand(role parentRole) (err error) {
247247 // parametrizing these values for all control modes.
248248 // THIS BREAKS TASK CLASS REUSE! See OCTRL-227
249249 if class .Control .Mode == controlmode .BASIC ||
250+ class .Control .Mode == controlmode .HOOK ||
250251 class .Control .Mode == controlmode .DIRECT ||
251252 class .Control .Mode == controlmode .FAIRMQ {
252253 var varStack map [string ]string
@@ -431,11 +432,12 @@ func fillCommonProperties(t *Task, propMap controlcommands.PropertyMap) {
431432 propMap ["environment_id" ] = envId .String ()
432433}
433434
434- func (t * Task ) BuildPropertyMap (bindMap channel.BindMap ) (propMap controlcommands.PropertyMap ) {
435+ func (t * Task ) BuildPropertyMap (bindMap channel.BindMap ) (propMap controlcommands.PropertyMap , err error ) {
435436 propMap = make (controlcommands.PropertyMap )
436437 if class := t .GetTaskClass (); class != nil {
437438 if class .Control .Mode != controlmode .BASIC { // if it's NOT a basic task or hook, we template the props
438439 if t .GetParent () == nil {
440+ err = fmt .Errorf ("cannot build property map for parentless task %s (id %s)" , t .name , t .taskId )
439441 return
440442 }
441443
@@ -444,17 +446,18 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
444446
445447 // First we get the full varStack from the parent role, and
446448 // consolidate it.
447- varStack , err := t .GetParent ().ConsolidatedVarStack ()
449+ var varStack map [string ]string
450+ varStack , err = t .GetParent ().ConsolidatedVarStack ()
448451 if err != nil {
449- log . WithError ( err ). Error ("cannot fetch variables stack for property map" )
452+ err = fmt . Errorf ("cannot fetch variables stack for property map: %w" , err )
450453 return
451454 }
452455
453456 // We wrap the parent varStack around the class Defaults, ensuring
454457 // the class Defaults are overridden by anything else.
455458 varStack , err = gera .MakeStringMapWithMap (varStack ).WrappedAndFlattened (class .Defaults )
456459 if err != nil {
457- log . WithError ( err ). Error ("cannot fetch task class defaults for property map" )
460+ err = fmt . Errorf ("cannot fetch task class defaults for property map: %w" , err )
458461 return
459462 }
460463
@@ -476,10 +479,10 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
476479 endpoint , ok := t .localBindMap [inbCh .Name ]
477480 if ! ok {
478481 log .WithFields (logrus.Fields {
479- "channelName" : inbCh .Name ,
480- "taskName" : t .name ,
481- }).
482- Error ("endpoint not allocated for inbound channel" )
482+ "channelName" : inbCh .Name ,
483+ "taskName" : t .name ,
484+ }).
485+ Warn ("endpoint not allocated for inbound channel" )
483486 continue
484487 }
485488
@@ -493,7 +496,11 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
493496 }
494497 for _ , outboundCh := range channel .MergeOutbound (t .GetParent ().CollectOutboundChannels (), class .Connect ) {
495498 // We get the FairMQ-formatted propertyMap from the outbound channel spec
496- chanProps := outboundCh .ToFMQMap (bindMap )
499+ var chanProps controlcommands.PropertyMap
500+ chanProps , err = outboundCh .ToFMQMap (bindMap )
501+ if err != nil {
502+ return nil , err
503+ }
497504
498505 // And if valid, we copy it into the task's propertyMap
499506 if len (chanProps ) > 0 {
@@ -539,7 +546,7 @@ func (t *Task) BuildPropertyMap(bindMap channel.BindMap) (propMap controlcommand
539546 }
540547
541548 }
542- return propMap
549+ return propMap , err
543550}
544551
545552func (t * Task ) GetMesosCommandTarget () controlcommands.MesosCommandTarget {
0 commit comments