How to use the oncall.db.init function in oncall

To help you get started, we’ve selected a few oncall examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linkedin / oncall / src / oncall / bin / notifier.py View on Github external
def init_notifier(config):
    db.init(config['db'])
    global default_timezone
    default_timezone = config['notifier'].get('default_timezone', 'US/Pacific')
    if config['notifier']['skipsend']:
        global send_message
        send_message = blackhole
github linkedin / oncall / src / oncall / bin / scheduler.py View on Github external
def main():
    config = utils.read_config(sys.argv[1])
    db.init(config['db'])

    cycle_time = config.get('scheduler_cycle_time', 3600)
    schedulers = {}

    while 1:
        connection = db.connect()
        db_cursor = connection.cursor(db.DictCursor)

        start = time.time()
        # Load all schedulers
        db_cursor.execute('SELECT name FROM scheduler')
        schedulers = {}
        for row in db_cursor:
            try:
                scheduler_name = row['name']
                if scheduler_name not in schedulers: