def load_AcmeData(self, num_of_cust): """ Reset databases and use the AcmeAir database loader to populate initial customer, flight and airportmapping data. Does NOT generate user data like bookings. """ print ("num_of_cust: ", num_of_cust) acmeair = AcmeAirUtils() try: if acmeair.is_acmeair_running() != 0: raise RuntimeError(""" AcmeAir is already running which may cause unexpected results when resetting databases. Please shut down the app and try again. """) else: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() acmeair.start_acmeair() acmeair.load_data(num_of_cust) finally: acmeair.stop_acmeair()
def load_AcmeData(self, num_of_cust): """ Reset databases and use the AcmeAir database loader to populate initial customer, flight and airportmapping data. Does NOT generate user data like bookings. """ print("num_of_cust: ", num_of_cust) acmeair = AcmeAirUtils() try: if acmeair.is_acmeair_running() != 0: raise RuntimeError(""" AcmeAir is already running which may cause unexpected results when resetting databases. Please shut down the app and try again. """) else: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() acmeair.start_acmeair() acmeair.load_data(num_of_cust) finally: acmeair.stop_acmeair()
finally: acmeair.stop_acmeair() if __name__ =='__main__': """ Utility to create test databases and load data """ import argparse parser = argparse.ArgumentParser(description="Utility to load AcmeAir data required for python spark-cloudant tests") group = parser.add_mutually_exclusive_group(required=True) group.add_argument('-cleanup', action='store_true', help='Drop all test databases') group.add_argument('-load', help='Reset and Load databases with the given # of users. -load 0 to just recreate databases and indexes.', type=int) args = parser.parse_args() dataloader = DataLoader() if args.load is not None: if args.load == 0: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() else: dataloader.load_AcmeData(args.load) dataloader.load_SpecCharValuePredicateData() elif args.cleanup: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.drop_all_databases()
""" import argparse parser = argparse.ArgumentParser( description= "Utility to load AcmeAir data required for python spark-cloudant tests" ) group = parser.add_mutually_exclusive_group(required=True) group.add_argument('-cleanup', action='store_true', help='Drop all test databases') group.add_argument( '-load', help= 'Reset and Load databases with the given # of users. -load 0 to just recreate databases and indexes.', type=int) args = parser.parse_args() dataloader = DataLoader() if args.load is not None: if args.load == 0: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.reset_databases() else: dataloader.load_AcmeData(args.load) dataloader.load_SpecCharValuePredicateData() elif args.cleanup: cloudantUtils = CloudantDbUtils(test_properties) cloudantUtils.drop_all_databases()