Example usage for org.apache.hadoop.yarn.webapp MimeType JSON

List of usage examples for org.apache.hadoop.yarn.webapp MimeType JSON

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.webapp MimeType JSON.

Prototype

String JSON

To view the source code for org.apache.hadoop.yarn.webapp MimeType JSON.

Click Source Link

Usage

From source file:com.simiacryptus.mindseye.applications.ArtistryAppBase.java

License:Apache License

/**
 * Init.//from  w w w . j  ava2 s .c o m
 *
 * @param log the log
 */
public void init(final NotebookOutput log) {
    log.getHttpd().addHandler("gpu.json", MimeType.JSON, out -> {
        try {
            JsonUtil.getMapper().writer().writeValue(out, CudaSystem.getExecutionStatistics());
            //JsonUtil.MAPPER.writer().writeValue(out, new HashMap<>());
            out.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    });
    //server.dataReciever
    //server.init();
    //server.start();
    //    @Nonnull String logName = "cuda_" + log.getName() + ".log";
    //    log.p(log.file((String) null, logName, "GPU Log"));
    //    CudaSystem.addLog(new PrintStream(log.file(logName)));
}

From source file:com.simiacryptus.mindseye.applications.ArtistryUtil.java

License:Apache License

/**
 * Add layers handler./*from  ww  w.jav  a2 s  . c  o m*/
 *
 * @param painterNetwork the painter network
 * @param server         the server
 */
public static void addLayersHandler(final DAGNetwork painterNetwork, final FileNanoHTTPD server) {
    if (null != server)
        server.addHandler("layers.json", MimeType.JSON, out -> {
            try {
                JsonUtil.getMapper().writer().writeValue(out, TestUtil.samplePerformance(painterNetwork));
                out.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        });
}