def update_db_indexes(cursor): commands = ("""REINDEX DATABASE transactional""", ) try: for command in commands: cursor.execute(command) except Exception as e: logger.exception("Error in update_db_indexes: %s", e) return -1 else: logger.info("update_db_indexes run successfully") return 0
def inner(cursor): commands = db_script_function(cursor) function_name = db_script_function.__qualname__ try: for command in commands: cursor.execute(command) except Exception as e: logger.exception("Error in %s: %s", function_name, e) return -1 else: logger.info("%s run successfully", function_name) return 0
def update_db_indexes(cursor): commands = ( """REINDEX DATABASE transactional""", ) try: for command in commands: cursor.execute(command) except Exception as e: logger.exception("Error in update_db_indexes: %s", e) return -1 else: logger.info("update_db_indexes run successfully") return 0
def move_data_archives(cursor): commands = ( """INSERT INTO archive_orders SELECT * from orders WHERE order_date < '2016-01-01' """, """DELETE from orders WHERE order_date < '2016-01-01' """,) try: for command in commands: cursor.execute(command) except Exception as e: logger.exception("Error in move_data_archives: %s", e) return -1 else: logger.info("move_data_archives run successfully") return 0
def move_data_archives(cursor): commands = ( """INSERT INTO archive_orders SELECT * from orders WHERE order_date < '2016-01-01' """, """DELETE from orders WHERE order_date < '2016-01-01' """, ) try: for command in commands: cursor.execute(command) except Exception as e: logger.exception("Error in move_data_archives: %s", e) return -1 else: logger.info("move_data_archives run successfully") return 0
print_test_list, paa_trust_store_path): coloredlogs.install(level=log_level, fmt=log_format, logger=logger) if print_test_list: print("Test sets:") for name in base.configurable_tests(): print(f"\t{name}") print("Test cases:") for name in base.configurable_test_cases(): print(f"\t{name}") return logger.info("Test Parameters:") logger.info(f"\tController NodeId: {controller_nodeid}") logger.info(f"\tDevice NodeId: {device_nodeid}") logger.info(f"\tTest Timeout: {timeout}s") logger.info(f"\tDiscriminator: {discriminator}") logger.info(f"\tEnabled Tests: {enable_test}") logger.info(f"\tDisabled Tests: {disable_test}") SetTestSet(enable_test, disable_test) do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, paa_trust_store_path) if __name__ == "__main__": try: run() except Exception as ex: logger.exception(ex) TestFail("Exception occurred when running tests.")