cascading.util.Util.formatDurationFromMillis()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中cascading.util.Util.formatDurationFromMillis()方法的一些代码示例,展示了Util.formatDurationFromMillis()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.formatDurationFromMillis()方法的具体详情如下:
包路径:cascading.util.Util
类名称:Util
方法名:formatDurationFromMillis

Util.formatDurationFromMillis介绍

暂无

代码示例

代码示例来源:origin: cwensel/cascading

  1. public void setRuleDuration( Rule rule, long begin, long end )
  2. {
  3. Map<String, Long> durations = ruleDurations.get( rule.getRulePhase() );
  4. if( durations == null )
  5. {
  6. durations = new LinkedHashMap<>();
  7. ruleDurations.put( rule.getRulePhase(), durations );
  8. }
  9. if( durations.containsKey( rule.getRuleName() ) )
  10. throw new IllegalStateException( "duplicate rule found: " + rule.getRuleName() );
  11. long duration = end - begin;
  12. // print these as we go
  13. if( duration > THRESHOLD_SECONDS * 1000 )
  14. LOG.info( "rule: {}, took longer than {} seconds: {}", rule.getRuleName(), THRESHOLD_SECONDS, formatDurationFromMillis( duration ) );
  15. durations.put( rule.getRuleName(), duration );
  16. }

代码示例来源:origin: cwensel/cascading

  1. protected void finalizeNodeSliceCapture()
  2. {
  3. long startOfFinalPolling = System.currentTimeMillis();
  4. long lastLog = 0;
  5. long retries = 0;
  6. boolean allNodesFinished;
  7. while( true )
  8. {
  9. allNodesFinished = updateNodesStatus();
  10. flowStepStats.recordChildStats();
  11. if( allNodesFinished && flowStepStats.hasCapturedFinalDetail() )
  12. break;
  13. if( ( System.currentTimeMillis() - startOfFinalPolling ) >= blockForCompletedChildDetailDuration )
  14. break;
  15. if( System.currentTimeMillis() - lastLog > 1000 )
  16. {
  17. if( !allNodesFinished )
  18. flowStep.logInfo( "did not capture all completed node details, will retry in {}, prior retries: {}", formatDurationFromMillis( pollingInterval ), retries );
  19. else
  20. flowStep.logInfo( "did not capture all completed slice details, will retry in {}, prior retries: {}", formatDurationFromMillis( pollingInterval ), retries );
  21. lastLog = System.currentTimeMillis();
  22. }
  23. retries++;
  24. sleepForPollingInterval();
  25. }
  26. if( !allNodesFinished )
  27. flowStep.logWarn( "unable to capture all completed node details or determine final state within configured duration: {}, configure property to increase wait duration: '{}'", formatDurationFromMillis( blockForCompletedChildDetailDuration ), CascadingStats.STATS_COMPLETE_CHILD_DETAILS_BLOCK_DURATION );
  28. if( !flowStepStats.hasCapturedFinalDetail() )
  29. flowStep.logWarn( "unable to capture all completed slice details within configured duration: {}, configure property to increase wait duration: '{}'", formatDurationFromMillis( blockForCompletedChildDetailDuration ), CascadingStats.STATS_COMPLETE_CHILD_DETAILS_BLOCK_DURATION );
  30. }

代码示例来源:origin: cascading/cascading-hadoop2-tez-stats

  1. private boolean updateAllTasks( TimelineClient timelineClient )
  2. {
  3. if( allChildrenFinished )
  4. return true;
  5. long startTime = System.currentTimeMillis();
  6. int count = 0;
  7. for( FlowSliceStats sliceStats : sliceStatsMap.values() )
  8. {
  9. if( sliceStats.getStatus().isFinished() )
  10. continue;
  11. TaskStatus taskStatus = getTaskStatusFor( timelineClient, sliceStats.getProcessSliceID() );
  12. updateSliceWith( (TezSliceStats) sliceStats, taskStatus, System.currentTimeMillis() );
  13. count++;
  14. }
  15. if( count == 0 )
  16. allChildrenFinished = true;
  17. logInfo( "updated {} slices in: {}", count, formatDurationFromMillis( System.currentTimeMillis() - startTime ) );
  18. return sliceStatsMap.size() == getTotalTaskCount();
  19. }

代码示例来源:origin: cwensel/cascading

  1. private boolean updateAllTasks( TimelineClient timelineClient )
  2. {
  3. if( allChildrenFinished )
  4. return true;
  5. long startTime = System.currentTimeMillis();
  6. int count = 0;
  7. for( FlowSliceStats sliceStats : sliceStatsMap.values() )
  8. {
  9. if( sliceStats.getStatus().isFinished() )
  10. continue;
  11. TaskStatus taskStatus = getTaskStatusFor( timelineClient, sliceStats.getProcessSliceID() );
  12. updateSliceWith( (TezSliceStats) sliceStats, taskStatus, System.currentTimeMillis() );
  13. count++;
  14. }
  15. if( count == 0 )
  16. allChildrenFinished = true;
  17. logInfo( "updated {} slices in: {}", count, formatDurationFromMillis( System.currentTimeMillis() - startTime ) );
  18. return sliceStatsMap.size() == getTotalTaskCount();
  19. }

代码示例来源:origin: cwensel/cascading

  1. private void notifyInterrupted()
  2. {
  3. if( interrupted.isEmpty() )
  4. return;
  5. for( RuleResult ruleResult : interrupted )
  6. getFlowLogger().logInfo( "rule registry: {}, planned longer than default duration, was cancelled", ruleResult.getRegistry().getName() );
  7. if( interrupted.size() == registrySet.size() )
  8. throw new PlannerException( "planner registry timeout exceeded for all registries: " + formatDurationFromMillis( registrySet.getPlannerTimeoutSec() * 1000 ) );
  9. if( !registrySet.isIgnoreFailed() || success.isEmpty() )
  10. rethrow( interrupted.get( 0 ).getPlannerException() );
  11. }

代码示例来源:origin: cwensel/cascading

  1. getFlowLogger().logWarn( "planner cancelling long running registries past timeout period: {}, see RuleRegistrySet#setPlannerTimeoutSec() to change timeout", formatDurationFromMillis( registrySet.getPlannerTimeoutSec() * 1000 ) );
  2. else
  3. getFlowLogger().logInfo( "first registry completed, planner cancelling remaining running registries: {}, successful: {}", futures.size(), success.size() );

代码示例来源:origin: cwensel/cascading

  1. LOG.warn( "no counters fetched, max num consecutive retries reached: {}, type: {}, status: {}", maxFetchAttempts, stats.getType(), stats.getStatus() );
  2. else
  3. LOG.warn( "stale counters being returned, max num consecutive retries reached, age: {}, type: {}, status: {}", formatDurationFromMillis( currentTimeMillis() - lastFetch ), stats.getType(), stats.getStatus() );

代码示例来源:origin: cwensel/cascading

  1. String duration = formatDurationFromMillis( System.currentTimeMillis() - lastFetch );

代码示例来源:origin: cwensel/cascading

  1. int added = total - startSize;
  2. int remaining = getTotalTaskCount() - total;
  3. String duration = formatDurationFromMillis( System.currentTimeMillis() - startTime );

代码示例来源:origin: cascading/cascading-hadoop2-mr1

  1. String duration = formatDurationFromMillis( System.currentTimeMillis() - lastFetch );

代码示例来源:origin: cwensel/cascading

  1. protected void planPhases( PlannerContext plannerContext, boolean logAsInfo, RuleResult ruleResult )
  2. {
  3. ProcessLogger logger = plannerContext.getLogger();
  4. for( PlanPhase phase : PlanPhase.values() ) // iterate in order, all planner phases
  5. {
  6. long beginPhase = System.currentTimeMillis();
  7. logPhase( logger, logAsInfo, "starting rule phase: {}", phase );
  8. try
  9. {
  10. switch( phase.getAction() )
  11. {
  12. case Resolve:
  13. resolveElements( ruleResult );
  14. break;
  15. case Rule:
  16. executeRulePhase( phase, plannerContext, ruleResult );
  17. break;
  18. }
  19. }
  20. finally
  21. {
  22. long endPhase = System.currentTimeMillis();
  23. ruleResult.setPhaseDuration( phase, beginPhase, endPhase );
  24. logPhase( logger, logAsInfo, "ending rule phase: {}, duration: {}", phase, formatDurationFromMillis( endPhase - beginPhase ) );
  25. }
  26. }
  27. }

代码示例来源:origin: cwensel/cascading

  1. public RuleResult exec( PlannerContext plannerContext, FlowElementGraph flowElementGraph )
  2. {
  3. RuleResult ruleResult = new RuleResult( registry, flowElementGraph );
  4. ProcessLogger logger = plannerContext.getLogger();
  5. int size = flowElementGraph.vertexSet().size();
  6. boolean logAsInfo = size >= ELEMENT_THRESHOLD;
  7. if( logAsInfo )
  8. logger.logInfo( "elements in graph: {}, info logging threshold: {}, logging planner execution status", size, ELEMENT_THRESHOLD );
  9. long beginExec = System.currentTimeMillis();
  10. try
  11. {
  12. planPhases( plannerContext, logAsInfo, ruleResult );
  13. }
  14. catch( Exception exception )
  15. {
  16. ruleResult.setPlannerException( exception );
  17. }
  18. finally
  19. {
  20. long endExec = System.currentTimeMillis();
  21. ruleResult.setDuration( beginExec, endExec );
  22. RuleResult.ResultStatus status = ruleResult.getResultStatus();
  23. String duration = formatDurationFromMillis( endExec - beginExec );
  24. logPhase( logger, logAsInfo, "rule registry completed: {}, with status: {}, and duration: {}", registry.getName(), status, duration );
  25. }
  26. return ruleResult;
  27. }

代码示例来源:origin: cascading/cascading-hadoop2-tez-stats

  1. int added = total - startSize;
  2. int remaining = getTotalTaskCount() - total;
  3. String duration = formatDurationFromMillis( System.currentTimeMillis() - startTime );

代码示例来源:origin: cwensel/cascading

  1. logInfo( " completed in: " + formatDurationFromMillis( flowStats.getDuration() ) );
  2. else
  3. logInfo( " completed in: " + formatDurationFromMillis( flowStats.getDuration() ) + ", using cpu time: " + formatDurationFromMillis( totalSliceCPUSeconds ) );

代码示例来源:origin: cwensel/cascading

  1. protected RuleResult execPlannerFor( RuleRegistry ruleRegistry )
  2. {
  3. flowPlanner.configRuleRegistryDefaults( ruleRegistry );
  4. String registryName = ruleRegistry.getName();
  5. RuleExec ruleExec = new RuleExec( traceWriter, ruleRegistry );
  6. PlannerContext plannerContext = new PlannerContext( ruleRegistry, flowPlanner, flowDef, flow, traceWriter.isTransformTraceEnabled() );
  7. RuleResult ruleResult = ruleExec.exec( plannerContext, flowElementGraph );
  8. getFlowLogger().logInfo( "executed rule registry: {}, completed as: {}, in: {}", registryName, ruleResult.getResultStatus(), formatDurationFromMillis( ruleResult.getDuration() ) );
  9. traceWriter.writeTracePlan( registryName, "completed-flow-element-graph", ruleResult.getAssemblyGraph() );
  10. traceWriter.writeStats( plannerContext, ruleResult );
  11. Exception plannerException;
  12. if( ruleResult.isSuccess() )
  13. plannerException = flowPlanner.verifyResult( ruleResult );
  14. else
  15. plannerException = ruleResult.getPlannerException(); // will be re-thrown below
  16. if( plannerException != null && plannerException instanceof PlannerException && ( (PlannerException) plannerException ).getElementGraph() != null )
  17. traceWriter.writeTracePlan( registryName, "failed-source-element-graph", ( (PlannerException) plannerException ).getElementGraph() );
  18. if( ruleResult.isSuccess() && plannerException != null )
  19. rethrow( plannerException );
  20. return ruleResult;
  21. }

相关文章