コード例 #1
0
def generate_kmet_distribution_simple(nbAgent,
                                      infile_path,
                                      infile_name,
                                      outfile_path=None,
                                      outfile_name=None):
    java_args = ['-jar']
    nbAgent = str(nbAgent)
    if outfile_path is None:
        outfile_path = infile_path

    if outfile_name is None:
        dist = '_kmet' + str(nbAgent)
        outfile_name = infile_name + dist

    if os.path.isfile(outfile_path + outfile_name + '.dcf'):
        return outfile_path, outfile_name

    temp_graph_file = infile_path + outfile_name + 'tempgraph'
    # buildGraph
    try:
        os.remove(temp_graph_file + '.gra')
    except OSError:
        pass
    args = java_args + [BUILDGRAPH_JAR] + \
        [infile_path + infile_name, temp_graph_file]
    log = sysutils.jarWrapper(*args)
    # kMetis
    try:
        os.remove(temp_graph_file + '.gra.part.' + nbAgent)
    except OSError:
        pass
    args = [KMETIS_EX, temp_graph_file + '.gra', nbAgent]
    log = sysutils.exWrapper(*args)
    # graph2DCF
    args = java_args + [GRAPH2DCF_JAR] + [
        infile_path + infile_name, temp_graph_file + '.gra.part.' + nbAgent,
        outfile_path + outfile_name + '.dcf'
    ]
    log = sysutils.jarWrapper(*args)
    # clean un peu...
    if os.path.isfile(temp_graph_file + '.gra'):
        os.remove(temp_graph_file + '.gra')
    if os.path.isfile(temp_graph_file + '.gra.part.' + nbAgent):
        os.remove(temp_graph_file + '.gra.part.' + nbAgent)
    return outfile_path, outfile_name
コード例 #2
0
ファイル: futils.py プロジェクト: le-gorgo/dicf
def generate_kmet_distribution_simple(nbAgent, infile_path, infile_name, outfile_path=None, outfile_name=None):
    java_args = ["-jar"]
    nbAgent = str(nbAgent)
    if outfile_path is None:
        outfile_path = infile_path

    if outfile_name is None:
        dist = "_kmet" + str(nbAgent)
        outfile_name = infile_name + dist

    if os.path.isfile(outfile_path + outfile_name + ".dcf"):
        return outfile_path, outfile_name

    temp_graph_file = infile_path + outfile_name + "tempgraph"
    # buildGraph
    try:
        os.remove(temp_graph_file + ".gra")
    except OSError:
        pass
    args = java_args + [BUILDGRAPH_JAR] + [infile_path + infile_name, temp_graph_file]
    log = sysutils.jarWrapper(*args)
    # kMetis
    try:
        os.remove(temp_graph_file + ".gra.part." + nbAgent)
    except OSError:
        pass
    args = [KMETIS_EX, temp_graph_file + ".gra", nbAgent]
    log = sysutils.exWrapper(*args)
    # graph2DCF
    args = (
        java_args
        + [GRAPH2DCF_JAR]
        + [infile_path + infile_name, temp_graph_file + ".gra.part." + nbAgent, outfile_path + outfile_name + ".dcf"]
    )
    log = sysutils.jarWrapper(*args)
    # clean un peu...
    if os.path.isfile(temp_graph_file + ".gra"):
        os.remove(temp_graph_file + ".gra")
    if os.path.isfile(temp_graph_file + ".gra.part." + nbAgent):
        os.remove(temp_graph_file + ".gra.part." + nbAgent)
    return outfile_path, outfile_name
コード例 #3
0
ファイル: singlerunner_backup.py プロジェクト: le-gorgo/dicf
def main(argsDict):
    JAVA_ARGS = ["-jar"]

    # TODO :here create an object experiment
    if argsDict["nogen"]:
        generateDependencies(argsDict)

    args = futils.computeArgs(CFLAUNCHER_JAR, argsDict, exe_args=JAVA_ARGS)
    result = sysutils.jarWrapper(*args)

    log_f = [GEN_PATH, os.path.basename(argsDict["infile"])[:-4], argsDict["var"], argsDict["method"]]
    log_filename = "".join(log_f)
    sysutils.writeToLog(log_filename, result)
コード例 #4
0
def main(argsDict):
    JAVA_ARGS = ['-jar']

    # TODO :here create an object experiment
    if argsDict['nogen']:
        generateDependencies(argsDict)

    args = futils.computeArgs(CFLAUNCHER_JAR, argsDict, exe_args=JAVA_ARGS)
    result = sysutils.jarWrapper(*args)

    log_f = [GEN_PATH, os.path.basename(
        argsDict['infile'])[:-4], argsDict['var'], argsDict['method']]
    log_filename = "".join(log_f)
    sysutils.writeToLog(log_filename, result)