def __init__(self, LIVE=False): dbGlobals.connect() RestartingGreenlet.__init__(self, LIVE=LIVE) self.SLEEP = 40 # Run every 10 seconds self.LIVE = LIVE
""" Script to compute the daily service reports for escalators and elevators. This script will update the database and write json files for each updated day. """ # Connect to the database from dcmetrometrics.common import dbGlobals dbGlobals.connect() import sys, os from datetime import datetime, date, timedelta import gc from operator import attrgetter # gc.set_debug(gc.DEBUG_STATS) from dcmetrometrics.common.dbGlobals import G from dcmetrometrics.eles import dbUtils from dcmetrometrics.common.metroTimes import getLastOpenTime from dcmetrometrics.eles.models import Unit, SymptomCode, UnitStatus, SystemServiceReport from dcmetrometrics.common.globals import WWW_DIR from dcmetrometrics.common.utils import gen_days from dcmetrometrics.common.JSONifier import JSONWriter import argparse parser = argparse.ArgumentParser(description='Run daily service reports.') parser.add_argument('--all', action = 'store_true', help='Compute all, instead of a one day update.') ########################################## # Set up logging
def connect(): dbGlobals.connect()