public String getExecutionOffsetText(Execution ex){ if(ex.getChain() == null || ex.getChain().getStarted() == null || ex.getStarted() == null){ return null; } else { return String.format("%6dms",ex.getStarted().getTime() - ex.getChain().getStarted().getTime()); } } public String getExecutionDurationText(Execution ex){
@Override public int compare(Execution e1, Execution e2) { return e1.getStarted().compareTo(e2.getStarted()); } });
public String getExecutionCompletionTime(Execution ex){ if(ex.getCompleted() != null){ return format.format(ex.getCompleted()); } else { return "unknown"; } } public String getExecutionStatusText(Execution ex){
if(logger.isInfoEnabled()){ try { ExecutionMetadata em = ExecutionMetadata.parseFrom( job.getExecutionMetadata(),job.getContentItem().getUri()); ChainExecution ce = em.getChainExecution(); long cd = ce.getDuration(); StringBuilder message = new StringBuilder("> processed ContentItem ") .append(job.getContentItem().getUri()).append(" with Chain '") .append(ce.getChainName()).append("' in ").append(ce.getDuration()).append("ms | "); List<Execution> ees = new ArrayList<Execution>(em.getEngineExecutions().values()); message.append(", "); long ed = ee.getDuration(); eds = eds + ed; int edp = Math.round(ed*100/(float)cd); message.append(ee.getExecutionNode().getEngineName()) .append(": ").append(ed).append("ms (").append(edp).append("%)");
private ExecutionMetadata(Graph executionMetadata, IRI contentItemUri, BlankNodeOrIRI ce){ chainExecution = new ChainExecution(executionMetadata, ce); engineExecutions = new HashMap<String,Execution>(); for(BlankNodeOrIRI ex : ExecutionMetadataHelper.getExecutions(executionMetadata, ce)){ Execution execution = new Execution(chainExecution,executionMetadata, ex); engineExecutions.put(execution.getExecutionNode().getEngineName(),execution); } }
BlankNodeOrIRI ce = ExecutionMetadataHelper.getChainExecution(executionMetadata, ci.getUri()); if(ce != null){ chainExecution = new ChainExecution(executionMetadata, ce); engineExecutions = new ArrayList<Execution>(); for(BlankNodeOrIRI ex : ExecutionMetadataHelper.getExecutions(executionMetadata, ce)){ engineExecutions.add(new Execution(chainExecution,executionMetadata, ex));
public abstract class Example { public abstract void example(Execution e); public final void run(boolean b, String s) { example(new Execution(b, s); } }
public String getExecutionStatusText(Execution ex){ if(ExecutionMetadata.STATUS_COMPLETED.equals(ex.getStatus())){ return "completed"; } else if(ExecutionMetadata.STATUS_FAILED.equals(ex.getStatus())){ return "failed"; } else if(ExecutionMetadata.STATUS_IN_PROGRESS.equals(ex.getStatus())){ return "in-progress"; } else if(ExecutionMetadata.STATUS_SCHEDULED.equals(ex.getStatus())){ return "scheduled"; } else if(ExecutionMetadata.STATUS_SKIPPED.equals(ex.getStatus())){ return "skipped"; } else { return "unknown"; } } public static class EntityExtractionSummary implements Comparable<EntityExtractionSummary> {
public String getExecutionDurationText(Execution ex){ if(ex.getDuration() == null){ return "[duration not available]"; } else if(ex.getDuration() < 1025){ return ex.getDuration()+"ms"; } else { return String.format("%.2fsec",(ex.getDuration().floatValue()/1000)); } } public String getExecutionStartTime(Execution ex){
public static ExecutionMetadata parseFrom(Graph executionMetadata, IRI contentItemUri){ BlankNodeOrIRI ce = ExecutionMetadataHelper.getChainExecution(executionMetadata, contentItemUri); ExecutionMetadata em; if(ce != null){ em = new ExecutionMetadata(executionMetadata, contentItemUri,ce); } else { em = null; } return em; }
public Execution(ChainExecution parent, Graph graph, BlankNodeOrIRI node) { this.chain = parent; this.graph = graph; this.node = node; BlankNodeOrIRI executionNode = ExecutionMetadataHelper.getExecutionNode(graph, node); if(executionNode != null){ this.executionNode = new ExecutionNode(graph, executionNode); } else { this.executionNode = null; } this.status = getReference(graph, node, ExecutionMetadata.STATUS); this.started = ExecutionMetadataHelper.getStarted(graph, node); this.completed = ExecutionMetadataHelper.getCompleted(graph, node); if(started != null && completed != null){ this.duration = completed.getTime() - started.getTime(); } else { this.duration = null; } }
private ExecutionMetadata(Graph executionMetadata, IRI contentItemUri, BlankNodeOrIRI ce){ chainExecution = new ChainExecution(executionMetadata, ce); engineExecutions = new HashMap<String,Execution>(); for(BlankNodeOrIRI ex : ExecutionMetadataHelper.getExecutions(executionMetadata, ce)){ Execution execution = new Execution(chainExecution,executionMetadata, ex); engineExecutions.put(execution.getExecutionNode().getEngineName(),execution); } }
public String getExecutionOffsetText(Execution ex){ if(ex.getChain() == null || ex.getChain().getStarted() == null || ex.getStarted() == null){ return null; } else { return String.format("%6dms",ex.getStarted().getTime() - ex.getChain().getStarted().getTime()); } } public String getExecutionDurationText(Execution ex){
public String getExecutionStartTime(Execution ex){ if(ex.getStarted() != null){ return format.format(ex.getStarted()); } else { return "unknown"; } } public String getExecutionCompletionTime(Execution ex){
public String getExecutionStatusText(Execution ex){ if(ExecutionMetadata.STATUS_COMPLETED.equals(ex.getStatus())){ return "completed"; } else if(ExecutionMetadata.STATUS_FAILED.equals(ex.getStatus())){ return "failed"; } else if(ExecutionMetadata.STATUS_IN_PROGRESS.equals(ex.getStatus())){ return "in-progress"; } else if(ExecutionMetadata.STATUS_SCHEDULED.equals(ex.getStatus())){ return "scheduled"; } else if(ExecutionMetadata.STATUS_SKIPPED.equals(ex.getStatus())){ return "skipped"; } else { return "unknown"; } } public static class EntityExtractionSummary implements Comparable<EntityExtractionSummary> {
public String getExecutionDurationText(Execution ex){ if(ex.getDuration() == null){ return "[duration not available]"; } else if(ex.getDuration() < 1025){ return ex.getDuration()+"ms"; } else { return String.format("%.2fsec",(ex.getDuration().floatValue()/1000)); } } public String getExecutionStartTime(Execution ex){
public static ExecutionMetadata parseFrom(Graph executionMetadata, IRI contentItemUri){ BlankNodeOrIRI ce = ExecutionMetadataHelper.getChainExecution(executionMetadata, contentItemUri); ExecutionMetadata em; if(ce != null){ em = new ExecutionMetadata(executionMetadata, contentItemUri,ce); } else { em = null; } return em; }
public String getExecutionCompletionTime(Execution ex){ if(ex.getCompleted() != null){ return format.format(ex.getCompleted()); } else { return "unknown"; } } public String getExecutionStatusText(Execution ex){
public Execution(ChainExecution parent, Graph graph, BlankNodeOrIRI node) { this.chain = parent; this.graph = graph; this.node = node; BlankNodeOrIRI executionNode = ExecutionMetadataHelper.getExecutionNode(graph, node); if(executionNode != null){ this.executionNode = new ExecutionNode(graph, executionNode); } else { this.executionNode = null; } this.status = getReference(graph, node, ExecutionMetadata.STATUS); this.started = ExecutionMetadataHelper.getStarted(graph, node); this.completed = ExecutionMetadataHelper.getCompleted(graph, node); if(started != null && completed != null){ this.duration = completed.getTime() - started.getTime(); } else { this.duration = null; } }
public String getExecutionStartTime(Execution ex){ if(ex.getStarted() != null){ return format.format(ex.getStarted()); } else { return "unknown"; } } public String getExecutionCompletionTime(Execution ex){