Esempio n. 1
0
def f10s():
    global app
    if 'onTimer' not in app.schema.schema_config:
        logging.warning('Schema config missed!')
        return
    for _timer_setting in app.schema.schema_config['onTimer']:
        #for _event_ontimer in proj['onTimer']:
        last_time = _timer_setting['last_call']
        print('EVENT_TIMER', last_time, _timer_setting['setting'])
        if Schema.check_timer(last_time, datetime.now(),
                              _timer_setting['setting']):
            for _callback in _timer_setting['callback']:
                _func = Schema.func_parse(_callback['action'])
                token = app.cache.get('guid')
                print('python cli.py ' + token + ' ' + _func['func_name'] +
                      ' ' + _func['params'] + ' ' +
                      Schema.env_encode(_callback['env']) + '>>schema.log')
                subprocess.Popen([
                    'python cli.py ' + token + ' ' + _func['func_name'] + ' ' +
                    _func['params'] + ' ' +
                    Schema.env_encode(_callback['env']) + '>>schema.log'
                ],
                                 shell=True)
                print('CALLBACK OK!', _callback)
            _timer_setting['last_call'] = datetime.now()
    #print app.schema.schema_config
    pass