示例#1
0
def start():
    result = None
    exc = None
    for i in range(START_ATTEMPT):
        try:
            conn = connection.get_conn()
            result = conn.wait_result(conn.send_event("Start"))
            break
        except exception.ConnectionBroken as e:
            exc = e
            if "reset" in e.message:
                logger.info("start failed: conn. reset. retry %d" % i)
                connection.close_conn()
                time.sleep(START_INTERVAL)
            else:
                raise e
    if result is None:
        raise exc

    ins_path = result[0]
    ins_path = base64.b64decode(ins_path)
    wait_for_idle()

    return ins_path
示例#2
0
def start():
    result = None
    exc = None
    for i in range(START_ATTEMPT):
        try:
            conn = connection.get_conn()
            result = conn.wait_result(conn.send_event("Start"))
            break
        except exception.ConnectionBroken as e:
            exc = e
            if "reset" in e.message:
                logger.info("start failed: conn. reset. retry %d" % i)
                connection.close_conn()
                time.sleep(START_INTERVAL)
            else:
                raise e
    if result is None:
        raise exc

    ins_path = result[0]
    ins_path = base64.b64decode(ins_path)
    wait_for_idle()

    return ins_path
示例#3
0
def close():
    connection.close_conn()
示例#4
0
def close():
    connection.close_conn()
示例#5
0
#Make init load to tables
#########################
#Start init load
logging.logging_fun(log, "Start initial data loading")

#Open inital loading json
expense_types_json = open("expense_types.json", "r", encoding="UTF-8")
types_info = json.load(expense_types_json)

#Initial loading
for type in types_info["Type"].keys():
    for subtype in types_info["Type"][type]:
        cursor.execute(
            "insert into Expenses.expense_types (EXPENSE_TYPE,EXPENSE_SUBTYPE) values ('"
            + type + "','" + subtype + "');")
        conn.commit()
        logging.logging_actions_fun(
            log, "Inserted into 'Expenses.expense_type' values: '" + type +
            "','" + subtype + "'")

#End init load
logging.logging_fun(log, "Initial data loading complete")

#Close open files
expense_types_json.close()
log.close()
#################
#Close connection
#################
connection.close_conn(conn_info)