Esempio n. 1
0
def one_graph_backup_aws(v_backup_subpath, isql_path, host, user, keyfile,
                         suffix):
    #backup_subpath = "/usr/local/virtuoso-opensource/share/virtuoso/vad/3t_backup"
    #isql_path = "/usr/bin/isql-vt"
    my_logger.debug("In one_graph_backup_aws(%s, %s, %s, %s, %s)" %
                    (v_backup_subpath, isql_path, host, user, keyfile, suffix))
    if suffix == "source":
        my_logger.debug("Collecting dict_ttSettings for %s and %s" %
                        (host, suffix))
        dict_ttSettings = dict_source_ttSettings
    elif suffix == "target":
        my_logger.debug("Collecting dict_ttSettings for %s and %s" %
                        (host, suffix))
        dict_ttSettings = dict_target_ttSettings

    print dict_ttSettings
    v_user = dict_ttSettings["virtuoso"]["users"]["dba"]["username"]
    my_logger.debug("Extracted virtuoso username as %s for %s" %
                    (v_user, host))

    v_password = dict_ttSettings["virtuoso"]["users"]["dba"]["password"]
    my_logger.debug("Extracted virtuoso password for %s" % (host))

    g_list = list()
    for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items():
        graph_name = v["graph_name"]
        g_list.append(graph_name)
        my_logger.debug("Initiating backup for graph %s" % graph_name)
        v_backup_path = "%s/%s/3t_%s-" % (v_backup_subpath, timestamp, k)
        v_dump_one_graph_subcmd = "EXEC=dump_one_graph(\'%s\',\'%s\',10000000);" % (
            graph_name, v_backup_path)
        v_dump_one_graph_cmd = "%s -U %s -P %s \"%s\"" % (
            isql_path, v_user, v_password, v_dump_one_graph_subcmd)

        print "Taking backup on VIRTUOSO HOST: %s and VIRTUOSO USER: %s, GRAPH: %s" % (
            host, v_user, graph_name)
        my_logger.debug(
            "Taking backup on VIRTUOSO HOST: %s and VIRTUOSO USER: %s, GRAPH: %s"
            % (host, v_user, graph_name))
        my_logger.debug(
            "Calling \"v_dump_one_graph_aws(%s, %s, %s, %s, %s) \" " %
            (v_backup_subpath, timestamp, v_dump_one_graph_cmd, host, user,
             keyfile))

        try:
            v_dump_one_graph_aws(v_backup_subpath, timestamp,
                                 v_dump_one_graph_cmd, host, user, keyfile)
        except:
            my_logger.error(
                "Calling \"v_dump_one_graph_aws() \" failed. Exiting")
            sys.exit("Calling \"v_dump_one_graph_aws() \" failed. Exiting")
        my_logger.debug("\"v_dump_one_graph_aws()\" successful.")

    return g_list
Esempio n. 2
0
def one_graph_backup_aws(virtuoso_user, virtuoso_password, subpath, isql_path, host, user, keyfile):
    env.virtuoso_user = virtuoso_user
    env.virtuoso_password = virtuoso_password
    env.subpath = subpath
    env.isql_path = isql_path
    count = 0
    for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items():
        count = count + 1
        env.graph_dir_name = "graph_" + str(count)
        env.graph_name = v["graph_name"]
        env.path = "%(subpath)s/%(timestamp)s/3t_%(graph_dir_name)s-"%env
        env.dump_one_graph_subcmd= "EXEC=dump_one_graph(\'%(graph_name)s\',\'%(path)s\',10000000);"%env
        dump_one_graph_cmd = "%(isql_path)s -U %(virtuoso_user)s -P %(virtuoso_password)s \"%(dump_one_graph_subcmd)s\""%env
        
        print "Taking backup on SOURCE VIRTUOSO SERVER: %(virtuoso_user)s, GRAPH: %(graph_dir_name)s"%env
        print "Executing command: %s"%dump_one_graph_cmd
        
        v_dump_one_graph_aws(subpath, env.timestamp, dump_one_graph_cmd, host, user, keyfile)
Esempio n. 3
0
def one_graph_backup_aws(v_backup_subpath, isql_path, host, user, keyfile, suffix):
    #backup_subpath = "/usr/local/virtuoso-opensource/share/virtuoso/vad/3t_backup"
    #isql_path = "/usr/bin/isql-vt"
    my_logger.debug("In one_graph_backup_aws(%s, %s, %s, %s, %s)"%(v_backup_subpath, isql_path, host, user, keyfile, suffix))
    if suffix == "source":
        my_logger.debug("Collecting dict_ttSettings for %s and %s"%(host, suffix))
        dict_ttSettings = dict_source_ttSettings        
    elif suffix == "target":
        my_logger.debug("Collecting dict_ttSettings for %s and %s"%(host, suffix))
        dict_ttSettings = dict_target_ttSettings
    
    print dict_ttSettings
    v_user = dict_ttSettings["virtuoso"]["users"]["dba"]["username"]
    my_logger.debug("Extracted virtuoso username as %s for %s"%(v_user, host))
    
    v_password = dict_ttSettings["virtuoso"]["users"]["dba"]["password"]
    my_logger.debug("Extracted virtuoso password for %s"%(host))
    
    g_list = list()
    for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items():
        graph_name = v["graph_name"]
        g_list.append(graph_name)
        my_logger.debug("Initiating backup for graph %s"%graph_name)
        v_backup_path = "%s/%s/3t_%s-"%(v_backup_subpath, timestamp, k)
        v_dump_one_graph_subcmd= "EXEC=dump_one_graph(\'%s\',\'%s\',10000000);"%(graph_name, v_backup_path)
        v_dump_one_graph_cmd = "%s -U %s -P %s \"%s\""%(isql_path, v_user, v_password, v_dump_one_graph_subcmd)
        
        print "Taking backup on VIRTUOSO HOST: %s and VIRTUOSO USER: %s, GRAPH: %s"%(host, v_user, graph_name)
        my_logger.debug("Taking backup on VIRTUOSO HOST: %s and VIRTUOSO USER: %s, GRAPH: %s"%(host, v_user, graph_name))
        my_logger.debug("Calling \"v_dump_one_graph_aws(%s, %s, %s, %s, %s) \" "%(v_backup_subpath, timestamp, v_dump_one_graph_cmd, host, user, keyfile))
        
        try:
            v_dump_one_graph_aws(v_backup_subpath, timestamp, v_dump_one_graph_cmd, host, user, keyfile)
        except:
            my_logger.error("Calling \"v_dump_one_graph_aws() \" failed. Exiting")
            sys.exit("Calling \"v_dump_one_graph_aws() \" failed. Exiting")
        my_logger.debug("\"v_dump_one_graph_aws()\" successful.")
    
    return  g_list