def cli(ctx, ed_dir, log_level): """ Command Line Interface for the Energy Dashboard. This tooling collects information from a number of data feeds, imports that data, transforms it, and inserts it into a database. """ # pass this logger as a child logger to the edl methods log.configure_logging() logger = logging.getLogger(__name__) logger.setLevel(log_level) log.debug( logger, { "name": __name__, "method": "cli", "ed_dir": ed_dir, "log_level": "%s" % log_level }) if ed_dir is None: ed_dir = os.path.curdir else: if not os.path.exists(ed_dir): log.critical( logger, { "name": __name__, "method": "cli", "ed_dir": ed_dir, "CRITICAL": "ed_dir does not exist" }) eddir = os.path.abspath(os.path.expanduser(ed_dir)) ctx.obj = {LOGGER: logger, EDDIR: eddir}
# ----------------------------------------------------------------------------- # Entrypoint # ----------------------------------------------------------------------------- def run(logger, manifest, config): # nothing to do, text files have already been copied to ./txt by # 10_down.py. pass # ----------------------------------------------------------------------------- # Main # ----------------------------------------------------------------------------- if __name__ == "__main__": if len(sys.argv) > 1: loglevel = sys.argv[1] else: loglevel = "INFO" log.configure_logging() logger = logging.getLogger(__name__) logger.setLevel(loglevel) log.debug(logger, { "name": __name__, "method": "main", "src": "20_unzp.py" }) with open('manifest.json', 'r') as json_file: m = json.load(json_file) run(logger, m, config())