cascading.flow.Flow.getConfigAsProperties()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(106)

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

Flow.getConfigAsProperties介绍

[英]Method getConfigAsProperties converts the internal configuration object into a java.util.Map of key value pairs.
[中]方法getConfigAsProperties将内部配置对象转换为java。util。键值对的映射。

代码示例

代码示例来源:origin: twitter/ambrose

/**
 * The onStarting event is fired when a Flow instance receives the start() message. A Flow is cut
 * down into executing units called stepFlow. A stepFlow contains a stepFlowJob which represents
 * the mapreduce job to be submitted to Hadoop. The ambrose graph is constructed from the step
 * graph found in flow object.
 *
 * @param flow the flow.
 */
@Override
@SuppressWarnings("unchecked")
public void onStarting(Flow flow) {
 // init flow
 List<FlowStep> steps = flow.getFlowSteps();
 totalNumberOfJobs = steps.size();
 currentFlowId = flow.getID();
 Properties props = new Properties();
 props.putAll(flow.getConfigAsProperties());
 try {
  statsWriteService.initWriteService(props);
 } catch (IOException e) {
  LOG.error("Failed to initialize statsWriteService", e);
 }
 // convert graph from cascading to ambrose
 AmbroseCascadingGraphConverter converter =
   new AmbroseCascadingGraphConverter(Flows.getStepGraphFrom(flow), nodesByName);
 converter.convert();
 AmbroseUtils.sendDagNodeNameMap(statsWriteService, currentFlowId, nodesByName);
}

代码示例来源:origin: twitter/ambrose

props.putAll(flow.getConfigAsProperties());
try {
 statsWriteService.initWriteService(props);

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

public Map<Object, Object> getFlowProperties()
 {
 return flow.getConfigAsProperties();
 }

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

public TraceWriter( Flow flow )
 {
 if( flow == null )
  return;
 this.properties = flow.getConfigAsProperties();
 this.flowName = Flows.getNameOrID( flow );
 this.processLogger = (ProcessLogger) flow;
 }

代码示例来源:origin: com.twitter.ambrose/ambrose-cascading

/**
 * The onStarting event is fired when a Flow instance receives the start() message. A Flow is cut
 * down into executing units called stepFlow. A stepFlow contains a stepFlowJob which represents
 * the mapreduce job to be submitted to Hadoop. The ambrose graph is constructed from the step
 * graph found in flow object.
 *
 * @param flow the flow.
 */
@Override
@SuppressWarnings("unchecked")
public void onStarting(Flow flow) {
 // init flow
 List<FlowStep> steps = flow.getFlowSteps();
 totalNumberOfJobs = steps.size();
 currentFlowId = flow.getID();
 Properties props = new Properties();
 props.putAll(flow.getConfigAsProperties());
 try {
  statsWriteService.initWriteService(props);
 } catch (IOException e) {
  LOG.error("Failed to initialize statsWriteService", e);
 }
 // convert graph from cascading to ambrose
 AmbroseCascadingGraphConverter converter =
   new AmbroseCascadingGraphConverter(Flows.getStepGraphFrom(flow), nodesByName);
 converter.convert();
 AmbroseUtils.sendDagNodeNameMap(statsWriteService, currentFlowId, nodesByName);
}

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

public void writeStats( PlannerContext plannerContext, RuleResult ruleResult )
 {
 Path path = getPlanStatsPath();
 if( path == null )
  return;
 File file = path.resolve( String.format( "planner-stats-%s-%s.txt", ruleResult.getRegistry().getName(), ruleResult.getResultStatus() ) ).toFile();
 processLogger.logInfo( "writing planner stats to: {}", file );
 file.getParentFile().mkdirs();
 try( PrintWriter writer = new PrintWriter( file ) )
  {
  Flow flow = plannerContext.getFlow();
  Map<Object, Object> configAsProperties = flow.getConfigAsProperties();
  writer.format( "cascading version: %s, build: %s\n", emptyOrValue( Version.getReleaseFull() ), emptyOrValue( Version.getReleaseBuild() ) );
  writer.format( "application id: %s\n", emptyOrValue( AppProps.getApplicationID( configAsProperties ) ) );
  writer.format( "application name: %s\n", emptyOrValue( AppProps.getApplicationName( configAsProperties ) ) );
  writer.format( "application version: %s\n", emptyOrValue( AppProps.getApplicationVersion( configAsProperties ) ) );
  writer.format( "platform: %s\n", emptyOrValue( flow.getPlatformInfo() ) );
  writer.format( "frameworks: %s\n", emptyOrValue( AppProps.getApplicationFrameworks( configAsProperties ) ) );
  writer.println();
  ruleResult.writeStats( writer );
  }
 catch( IOException exception )
  {
  processLogger.logError( "could not write stats", exception );
  }
 }

代码示例来源:origin: com.twitter.ambrose/ambrose-cascading3

props.putAll(flow.getConfigAsProperties());
try {
 statsWriteService.initWriteService(props);

相关文章