def run(args):
    """Main OSLOM runner function."""
    # Create an OSLOM runner with a temporary working directory
    oslom_runner = OslomRunner(tempfile.mkdtemp())

    # (Re-)create OSLOM output directory
    shutil.rmtree(args.oslom_output, ignore_errors=True)
    os.makedirs(args.oslom_output)

    # Read edges file
    logging.info("reading edges file: %s", args.edges)
    edges = []
    with open(args.edges, "r") as reader:
        for line in reader:
            source, target, weight = line.strip().split("\t", 2)
            edges.append((source, target, weight))
    logging.info("%d edge(s) found", len(edges))

    # Write temporary edges file with re-mapped Ids
    logging.info("writing temporary edges file with re-mapped Ids ...")
    oslom_runner.store_edges(edges)

    # Run OSLOM
    logging.info("running OSLOM ...")
    result = oslom_runner.run(
        args.oslom_exec, args.oslom_args,
        os.path.join(args.oslom_output, OSLOM_LOG_FILE))
    if result["retval"] != 0:
        logging.error("error running OSLOM, check the log file")
        return False
    logging.info("OSLOM executed in %.3f secs", result["time"])

    # Read back clusters found by OSLOM
    logging.info("reading OSLOM clusters output file ...")
    clusters = oslom_runner.read_clusters(args.min_cluster_size)
    logging.info(
        "found %d cluster(s) and %d with size >= %d",
        clusters["num_found"], len(clusters["clusters"]), args.min_cluster_size)

    # Write clusters file
    logging.info("writing output clusters file: %s", args.output_clusters)
    with open(args.output_clusters, "w") as writer:
        json.dump(clusters["clusters"], writer, separators=(",", ":"))

    # Store OSLOM output files
    logging.info("writing OSLOM output files ...")
    oslom_runner.store_output_files(args.oslom_output)

    # Clean-up temporary working directory
    oslom_runner.cleanup()

    # Finished
    logging.info("finished")
    return True