subprojects/parseq-tracevis-server/src/main/java/com/linkedin/parseq/GraphvizEngine.java
private Task<Exec.Result> createNewBuildTask(final String hash, final InputStream body) {

    LOG.info("building: " + hash);

    final Task<Void> createDotFile = Task.action("createDotFile",
        () -> Files.copy(body, pathToCacheFile(hash, "dot"), StandardCopyOption.REPLACE_EXISTING));

    // Task that runs a graphviz command.
    // We give process TIMEOUT_MS time to finish, after that
    // it will be forcefully killed.
    final Task<Exec.Result> graphviz = _exec
        .command("graphviz", _timeoutMs, TimeUnit.MILLISECONDS, _dotLocation, "-T" + Constants.OUTPUT_TYPE,
            "-Grankdir=LR", "-Gnewrank=true", "-Gbgcolor=transparent", pathToCacheFile(hash, "dot").toString(), "-o",
            pathToCacheFile(hash, Constants.OUTPUT_TYPE).toString());

    // Since Exec utility allows only certain number of processes
    // to run in parallel and rest is enqueued, we also specify
    // timeout on a task level equal to 2 * graphviz timeout.
    final Task<Exec.Result> graphvizWithTimeout = graphviz.withTimeout(_timeoutMs * 2, TimeUnit.MILLISECONDS);

    return createDotFile.andThen(graphvizWithTimeout);
  }
private Task<Exec.Result> createNewBuildTask(final String hash, final InputStream body) {

    LOG.info("building: " + hash);

    final Task<Void> createDotFile = Task.action("createDotFile",
        () -> Files.copy(body, pathToCacheFile(hash, "dot"), StandardCopyOption.REPLACE_EXISTING));

    // Task that runs a graphviz command.
    // We give process TIMEOUT_MS time to finish, after that
    // it will be forcefully killed.
    final Task<Exec.Result> graphviz = _exec
        .command("graphviz", _timeoutMs, TimeUnit.MILLISECONDS, _dotLocation, "-T" + Constants.OUTPUT_TYPE,
            "-Grankdir=LR", "-Gnewrank=true", "-Gbgcolor=transparent", pathToCacheFile(hash, "dot").toString(), "-o",
            pathToCacheFile(hash, Constants.OUTPUT_TYPE).toString());

    // Since Exec utility allows only certain number of processes
    // to run in parallel and rest is enqueued, we also specify
    // timeout on a task level equal to 2 * graphviz timeout.
    final Task<Exec.Result> graphvizWithTimeout = graphviz.withTimeout(_timeoutMs * 2, TimeUnit.MILLISECONDS);

    return createDotFile.andThen(graphvizWithTimeout);
  }
private Task < Exec . Result > createNewBuildTask ( final String hash , final InputStream body ) { LOG . info ( "building: " + hash ) ; final Task < Void > createDotFile = Task . action ( "createDotFile" , ( ) -> Files . copy ( body , pathToCacheFile ( hash , "dot" ) , StandardCopyOption . REPLACE_EXISTING ) ) ; // Task that runs a graphviz command. // We give process TIMEOUT_MS time to finish, after that // it will be forcefully killed. final Task < Exec . Result > graphviz = _exec . command ( "graphviz" , _timeoutMs , TimeUnit . MILLISECONDS , _dotLocation , "-T" + Constants . OUTPUT_TYPE , "-Grankdir=LR" , "-Gnewrank=true" , "-Gbgcolor=transparent" , pathToCacheFile ( hash , "dot" ) . toString ( ) , "-o" , pathToCacheFile ( hash , Constants . OUTPUT_TYPE ) . toString ( ) ) ; // Since Exec utility allows only certain number of processes // to run in parallel and rest is enqueued, we also specify // timeout on a task level equal to 2 * graphviz timeout. final Task < Exec . Result > graphvizWithTimeout = graphviz . withTimeout ( _timeoutMs * 2 , TimeUnit . MILLISECONDS ) ; return createDotFile . andThen ( graphvizWithTimeout ) ; }
Returns new task that builds graph using graphviz.
Returns new task that builds graph using graphviz .