def script_startup(script_description): util.load_configuration() # global variable holding database name database = 'ORCL' parser = argparse.ArgumentParser( description=script_description, epilog="See README for more detailed help.") parser.add_argument('destination', choices=['file', 'screen'], help='Where to send the graph') parser.add_argument('database', default=None, nargs='?', help='Name of the database') parser.add_argument('showsql', choices=['Y', 'N'], help='Show SQL that was executed (Y or N)') parser.add_argument('showdata', choices=['Y', 'N'], help='Show data returned by query (Y or N)') args = parser.parse_args() if args.database != None: database = args.database.upper() else: database = util.input_with_default('database', 'ORCL') myplot.destination = args.destination db.showsql = args.showsql db.showdata = args.showdata user = util.my_oracle_user password = util.get_oracle_password(database) # Set locale so we can test in IDLE locale.setlocale(locale.LC_ALL, 'C') return database, db.connection(user, password, database)
def script_startup(script_description): util.load_configuration() # global variable holding database name database='ORCL' parser = argparse.ArgumentParser(description=script_description, epilog="See README for more detailed help.") parser.add_argument('destination', choices=['file', 'screen'], help='Where to send the graph') parser.add_argument('database',default=None,nargs='?', help='Name of the database') parser.add_argument('showsql', choices=['Y', 'N'], help='Show SQL that was executed (Y or N)') parser.add_argument('showdata', choices=['Y', 'N'], help='Show data returned by query (Y or N)') args = parser.parse_args() if args.database != None: database = args.database.upper() else: database=util.input_with_default('database','ORCL') myplot.destination = args.destination db.showsql = args.showsql db.showdata = args.showdata user=util.my_oracle_user password=util.get_oracle_password() # Set locale so we can test in IDLE locale.setlocale(locale.LC_ALL, 'C') return database,db.connection(user,password,database)
except (TypeError) as e: raise Exception("Unable to get price return. Skipping") if ann_market_return < 0: market = Market("S&P") logging.debug("Using S&P as market instead") return market if __name__ == "__main__": logging.basicConfig(level = logging.INFO ) try: config_path = sys.argv[1] except IndexError as e: raise IndexError("Configuration file not provided") config = util.load_configuration(config_path) report_template = config.get("report_template") s3_bucket = config.get("s3_bucket") s3_report_dir = config.get("s3_report_dir") finnhub_key_path = config.get("finnhub_key_path") db_table_name = config.get("dynamo_table_name") logging.info(f"""Initialised application Using following configurations: S3 Bucket: {s3_bucket} S3 Report Dir: {s3_report_dir} Report template: {report_template} Database Table: {db_table_name}""") finnhub_client = util.login_finnhub(finnhub_key_path) db = util.login_db(db_table_name) stocks = util.rank_list_by_attr(db, "lastUpdated", 20, max=False) rf = RiskFree(5) for stock in stocks:
""" import argparse import db import saveawr import perfq import myplot import util """ Load the directory names, file names, and Oracle user name. """ util.load_configuration() # global variable holding database name database = 'ORCL' def ashcpu(): """ Generates a graph that shows cpu usage within an Oracle database by various parts of the application. The graph is configured by lines in the text file ashcpufile.txt. Each line is part of a client machine name and a label for machines with that pattern.