コード例 #1
0
def run():
    scheduler.start()
    try:
        asyncio.get_event_loop().run_forever()
    except (KeyboardInterrupt, SystemExit):
        print("Shutting down. Please wait...")
        scheduler.shutdown(wait=True)
        exit(0)
コード例 #2
0
 def setUp(self):
     scheduler.start()
     self.app = create_app('testing')
     self.client = self.app.test_client
     self.devices = {'name': 'test'}
     with self.app.app_context():
         db.create_all()
         db.session.add(Device(name='Test Fan', device_id='L-20', device_type=DeviceType.FAN))
         db.session.add(Device(name='Test RF', device_id='101-1', device_type=DeviceType.RF))
         db.session.commit()
コード例 #3
0
def run_process(sender):
    init_sender(sender)
    update_timestamp(sender)

    def update():
        update_subscribers(sender)
        listen_and_deliver(sender)
        update_timestamp(sender)
        print("Waiting", datetime.datetime.now())
        print()

    scheduler.add_job(update, 'interval', minutes=1)
    scheduler.start()
コード例 #4
0
async def main():
    await notify("Tromino: Starting...")

    scheduler.start()
    await notify("Tromino: Scheduler up")

    monitor_types = monitors.load_monitors()
    await notify(f"Tromino: Loading plugins - {', '.join([m for m in monitor_types])}")

    # job = scheduler.add_job(lambda: print(1), "interval", seconds=5)
    monitor_instances = await Monitor.load_all()
    await notify(f"Tromino: Loading monitor instances - {len(monitor_instances)}")

    for m in monitor_instances:
        try:
            await monitor_instances[m].job_start()
            await notify(f"Tromino: Starting {m}")
        except JobAlreadyStarted:
            pass

    await run_server()
    await notify("Tromino: HTTP Server stared")

    await notify("Tromino: Hello ! What could I do for you ?")
コード例 #5
0
ファイル: runserver.py プロジェクト: tomoyaogura/SmartHome
"""
MAIN APP
"""
import os

from app import create_app
from scheduler import scheduler

app_env = os.getenv('ENVIRONMENT', 'development')
app = create_app(app_env)

if __name__ == "__main__":
    scheduler.start()
    if app_env == 'deployment':
        app.run(host='0.0.0.0')
    else:
        app.run(host='0.0.0.0')
コード例 #6
0
 def ready(self):
     from scheduler import scheduler
     if settings.SCHEDULER_AUTOSTART: #turn off when using pytest
         scheduler.start()    
コード例 #7
0
 def ready(self):
     from scheduler import scheduler
     scheduler.start()
コード例 #8
0
ファイル: __init__.py プロジェクト: cooper-software/flaneur
def _run():
    try:
        scheduler.start()
        app.run(threaded=True, use_reloader=False, processes=1)
    except KeyboardInterrupt, SystemExit:
        scheduler.shutdown()
コード例 #9
0
ファイル: heroku.py プロジェクト: runt18/tron-ci
'''
Heroku scheduler will invoke this script every 10 minutes.
This is necessary to start cron jobs created at Tron CI.
'''
from scheduler import scheduler
import logging
import time


logging.basicConfig(
    level=logging.DEBUG,
    format='[%(asctime)s]: %(levelname)s : %(message)s'
)
logger = logging.getLogger(__name__)

logger.info('Reloading Tron CI scheduler')
scheduler.start()

# Giving enough time to restore and execute all jobs.
time.sleep(30)

# Shutdown scheduler after all jobs has finished.
scheduler.shutdown()
while scheduler.running:
    pass

logger.info('Reload process finished')
コード例 #10
0
ファイル: __init__.py プロジェクト: cooper-software/flaneur
def _run():
    try:
        scheduler.start()
        app.run(threaded=True, use_reloader=False, processes=1)
    except KeyboardInterrupt, SystemExit:
        scheduler.shutdown()