if (jid.isEmpty()) { html. p().__("Sorry, can't do anything without a JobID.").__(); return; if (job == null) { html. p().__("Sorry, ", jid, " not found.").__(); return; } catch(IOException e) { LOG.error("Error while reading "+confPath, e); html.p().__("Sorry got an error while reading conf file. ", confPath);
@Override protected void render(Block html) { ContainerId containerID; try { containerID = ContainerId.fromString($(CONTAINER_ID)); } catch (IllegalArgumentException e) { html.p().__("Invalid containerId " + $(CONTAINER_ID)).__(); return; } DIV<Hamlet> div = html.div("#content"); Container container = this.nmContext.getContainers().get(containerID); if (container == null) { div.h1("Unknown Container. Container might have completed, " + "please go back to the previous page and retry.").__(); return; } ContainerInfo info = new ContainerInfo(this.nmContext, container); info("Container information") .__("ContainerID", info.getId()) .__("ContainerState", info.getState()) .__("ExitStatus", info.getExitStatus()) .__("Diagnostics", info.getDiagnostics()) .__("User", info.getUser()) .__("TotalMemoryNeeded", info.getMemoryNeeded()) .__("TotalVCoresNeeded", info.getVCoresNeeded()) .__("ExecutionType", info.getExecutionType()) .__("logs", info.getShortLogLink(), "Link to logs"); html.__(InfoBlock.class); } }
String fileName = createAggregatedLogFileName(fileInfo.getFileName(), fileInfo.getLastModifiedTime()); html.p().a(url("containerlogs", $(CONTAINER_ID), $(APP_OWNER), fileInfo.getFileName(), "?start=-4096&" + LOG_AGGREGATION_TYPE + "=" + (timestamp - 1000) + "&end.time=" + (timestamp + 1000)), fileName + " : Total file length is " + fileInfo.getFileSize() + " bytes.").__();
private void printLocalLogFileDirectory(Block html, List<File> containerLogsDirs) { // Print out log types in lexical order Collections.sort(containerLogsDirs); boolean foundLogFile = false; for (File containerLogsDir : containerLogsDirs) { File[] logFiles = containerLogsDir.listFiles(); if (logFiles != null) { Arrays.sort(logFiles); for (File logFile : logFiles) { foundLogFile = true; html.p() .a(url("containerlogs", $(CONTAINER_ID), $(APP_OWNER), logFile.getName(), "?start=-4096"), logFile.getName() + " : Total file length is " + logFile.length() + " bytes.").__(); } } } if (!foundLogFile) { html.h1("No logs available for container " + $(CONTAINER_ID)); return; } }
protected long[] checkParseRange(Block html, long startIndex, long endIndex, long startTime, long endTime, long logLength, String logType) { long start = startIndex < 0 ? logLength + startIndex : startIndex; start = start < 0 ? 0 : start; start = start > logLength ? logLength : start; long end = endIndex < 0 ? logLength + endIndex : endIndex; end = end < 0 ? 0 : end; end = end > logLength ? logLength : end; end = end < start ? start : end; long toRead = end - start; if (toRead < logLength) { html.p().__("Showing " + toRead + " bytes of " + logLength + " total. Click ").a(url("logs", $(NM_NODENAME), $(CONTAINER_ID), $(ENTITY_STRING), $(APP_OWNER), logType, "?start=0&start.time=" + startTime + "&end.time=" + endTime), "here"). __(" for the full log.").__(); } return new long[]{start, end}; }
@Override public void render(Block html) { html. p(). __("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "Vivamus eu dui in ipsum tincidunt egestas ac sed nibh.", "Praesent quis nisl lorem, nec interdum urna.", "Duis sagittis dignissim purus sed sollicitudin.", "Morbi quis diam eu enim semper suscipit.", "Nullam pretium faucibus sapien placerat tincidunt.", "Donec eget lorem at quam fermentum vulputate a ac purus.", "Cras ac dui felis, in pulvinar est.", "Praesent tempor est sed neque pulvinar dictum.", "Nullam magna augue, egestas luctus sollicitudin sed,", "venenatis nec turpis.", "Ut ante enim, congue sed laoreet et, accumsan id metus.", "Mauris tincidunt imperdiet est, sed porta arcu vehicula et.", "Etiam in nisi nunc.", "Phasellus vehicula scelerisque quam, ac dignissim felis euismod a.", "Proin eu ante nisl, vel porttitor eros.", "Aliquam gravida luctus augue, at scelerisque enim consectetur vel.", "Donec interdum tempor nisl, quis laoreet enim venenatis eu.", "Quisque elit elit, vulputate eget porta vel, laoreet ac lacus.").__(); } }
private <T extends __> P<T> p_(T e, boolean inline) { return new P<T>("p", e, opt(false, inline, false)); }
@Override public P<T> a(String selector, String href, String anchorText) { return setSelector(a(), selector).$href(href).__(anchorText).__(); }
@Override public P<T> abbr(String cdata) { return abbr().__(cdata).__(); }
@Override public void render(Page.HTML<__> html) { html. title("short test"). p().__("should throw"); } }
@Override public P<T> _r(Object... lines) { _p(false, lines); return this; }
@Override public P<T> __(Object... lines) { _p(true, lines); return this; }