(sender, instance, **kwargs)
update the daq daemon configuration when changes be applied in the models
update the daq daemon configuration when changes be applied in the models
update the daq daemon configuration when changes be applied in the models
def _reinit_daq_daemons(sender, instance, **kwargs):
    """
    update the daq daemon configuration when changes be applied in the models
    """
    if type(instance) is Device:
        try:
            #todo select only one device not all for that protocol
            bp = BackgroundProcess.objects.get(pk=instance.protocol_id)
        except:
            return False
        bp.restart()
    elif type(instance) is Variable:
        try:
            # todo select only one device not all for that protocol
            bp = BackgroundProcess.objects.get(pk=instance.device.protocol_id)
        except:
            return False
        bp.restart()
    elif type(instance) is Scaling:
        for bp_pk in list(instance.variable_set.all().values_list('device__protocol_id').distinct()):
            try:
                bp = BackgroundProcess.objects.get(pk=bp_pk)
            except:
                return False
            bp.restart()
    else:
        logger.debug('post_save from %s' % type(instance))
def _reinit_daq_daemons ( sender , instance , * * kwargs ) : if type ( instance ) is Device : try : #todo select only one device not all for that protocol bp = BackgroundProcess . objects . get ( pk = instance . protocol_id ) except : return False bp . restart ( ) elif type ( instance ) is Variable : try : # todo select only one device not all for that protocol bp = BackgroundProcess . objects . get ( pk = instance . device . protocol_id ) except : return False bp . restart ( ) elif type ( instance ) is Scaling : for bp_pk in list ( instance . variable_set . all ( ) . values_list ( 'device__protocol_id' ) . distinct ( ) ) : try : bp = BackgroundProcess . objects . get ( pk = bp_pk ) except : return False bp . restart ( ) else : logger . debug ( 'post_save from %s' % type ( instance ) )