Beispiel #1
0
def routedispatcher(routestorun, type=None):
    ''' run all route(s). '''
    if type == '--retransmit':
        if not prepareretransmit():
            return 0
    elif type == '--retrycommunication':
        if not preparerecommunication():
            return 0
    elif type == '--automaticretrycommunication':
        if not prepareautomaticrecommunication():
            return 0
    elif type == '--retry':
        if not prepareretry():
            return 0
    stuff2evaluate = botslib.getlastrun()
    botslib.set_minta4query()
    for route in routestorun:
        foundroute = False
        botslib.setpreprocessnumber(SET_FOR_PROCESSING)
        for routedict in botslib.query(
                '''SELECT idroute     ,
                                                 fromchannel_id as fromchannel,
                                                 tochannel_id as tochannel,
                                                 fromeditype,
                                                 frommessagetype,
                                                 alt,
                                                 frompartner_id as frompartner,
                                                 topartner_id as topartner,
                                                 toeditype,
                                                 tomessagetype,
                                                 seq,
                                                 frompartner_tochannel_id,
                                                 topartner_tochannel_id,
                                                 testindicator,
                                                 translateind,
                                                 defer
                                        FROM routes
                                        WHERE idroute=%(idroute)s
                                        AND   active=%(active)s
                                        ORDER BY seq''', {
                    'idroute': route,
                    'active': True
                }):
            botsglobal.logger.info(_(u'running route %(idroute)s %(seq)s'), {
                'idroute': routedict['idroute'],
                'seq': routedict['seq']
            })
            botslib.setrouteid(routedict['idroute'])
            foundroute = True
            router(routedict)
            botslib.setrouteid('')
            botsglobal.logger.debug(u'finished route %s %s',
                                    routedict['idroute'], routedict['seq'])
        if not foundroute:
            botsglobal.logger.warning(_(u'there is no (active) route "%s".'),
                                      route)
    return stuff2evaluate
Beispiel #2
0
def routedispatcher(routestorun,type=None):
    ''' run all route(s). '''
    if type == '--retransmit':
        if not prepareretransmit():
            return 0
    elif type == '--retrycommunication':
        if not preparerecommunication():
            return 0
    elif type == '--automaticretrycommunication':
        if not prepareautomaticrecommunication():
            return 0
    elif type == '--retry':
        if not prepareretry():
            return 0
    stuff2evaluate = botslib.getlastrun()
    botslib.set_minta4query()
    for route in routestorun:
        foundroute=False
        botslib.setpreprocessnumber(SET_FOR_PROCESSING)
        for routedict in botslib.query('''SELECT idroute     ,
                                                 fromchannel_id as fromchannel,
                                                 tochannel_id as tochannel,
                                                 fromeditype,
                                                 frommessagetype,
                                                 alt,
                                                 frompartner_id as frompartner,
                                                 topartner_id as topartner,
                                                 toeditype,
                                                 tomessagetype,
                                                 seq,
                                                 frompartner_tochannel_id,
                                                 topartner_tochannel_id,
                                                 testindicator,
                                                 translateind,
                                                 defer
                                        FROM routes
                                        WHERE idroute=%(idroute)s
                                        AND   active=%(active)s
                                        ORDER BY seq''',
                                        {'idroute':route,'active':True}):
            botsglobal.logger.info(_(u'running route %(idroute)s %(seq)s'),{'idroute':routedict['idroute'],'seq':routedict['seq']})
            botslib.setrouteid(routedict['idroute'])
            foundroute=True
            router(routedict)
            botslib.setrouteid('')
            botsglobal.logger.debug(u'finished route %s %s',routedict['idroute'],routedict['seq'])
        if not foundroute:
            botsglobal.logger.warning(_(u'there is no (active) route "%s".'),route)
    return stuff2evaluate
Beispiel #3
0
 def run(self):
     for route in self.routestorun:
         botslib.setrouteid(route)
         self.router(route)
         botslib.setrouteid('')
     return True