本文整理了Java中cascading.util.Util.returnInstanceFieldIfExistsSafe()
方法的一些代码示例,展示了Util.returnInstanceFieldIfExistsSafe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.returnInstanceFieldIfExistsSafe()
方法的具体详情如下:
包路径:cascading.util.Util
类名称:Util
方法名:returnInstanceFieldIfExistsSafe
暂无
代码示例来源:origin: cwensel/cascading
protected static Job getJob( RunningJob runningJob )
{
if( runningJob == null ) // if null, job hasn't been submitted
return null;
Job job = Util.returnInstanceFieldIfExistsSafe( runningJob, "job" );
if( job == null )
{
LOG.warn( "unable to get underlying org.apache.hadoop.mapreduce.Job from org.apache.hadoop.mapred.RunningJob, task level task counters will be unavailable" );
return null;
}
return job;
}
代码示例来源:origin: cascading/cascading-hadoop2-mr1
protected static Job getJob( RunningJob runningJob )
{
if( runningJob == null ) // if null, job hasn't been submitted
return null;
Job job = Util.returnInstanceFieldIfExistsSafe( runningJob, "job" );
if( job == null )
{
LOG.warn( "unable to get underlying org.apache.hadoop.mapreduce.Job from org.apache.hadoop.mapred.RunningJob, task level task counters will be unavailable" );
return null;
}
return job;
}
代码示例来源:origin: cwensel/cascading
private static FrameworkClient getFrameworkClient( DAGClient dagClient )
{
if( dagClient instanceof TezTimelineClient )
return ( (TezTimelineClient) dagClient ).getFrameworkClient();
return Util.returnInstanceFieldIfExistsSafe( dagClient, "frameworkClient" );
}
}
代码示例来源:origin: cascading/cascading-hadoop2-tez-stats
private static FrameworkClient getFrameworkClient( DAGClient dagClient )
{
if( dagClient instanceof TezTimelineClient )
return ( (TezTimelineClient) dagClient ).getFrameworkClient();
return Util.returnInstanceFieldIfExistsSafe( dagClient, "frameworkClient" );
}
}
代码示例来源:origin: cwensel/cascading
static void injectIdentityMap( AbstractGraph graph )
{
// this overcomes jgrapht 0.9.0 using a LinkedHashMap vs an IdentityHashMap
// vertex not found errors will be thrown if this fails
Object specifics = Util.returnInstanceFieldIfExistsSafe( graph, "specifics" );
if( specifics == null )
{
LOG.warn( "unable to get jgrapht Specifics for identity map injection, may be using an incompatible jgrapht version" );
return;
}
boolean success = Util.setInstanceFieldIfExistsSafe( specifics, "vertexMapDirected", new IdentityHashMap<>() );
if( !success )
LOG.warn( "unable to set IdentityHashMap on jgrapht Specifics, may be using an incompatible jgrapht version" );
}
}
代码示例来源:origin: cwensel/cascading
public static String id( FlowElement flowElement )
{
if( flowElement instanceof Pipe )
return Pipe.id( (Pipe) flowElement );
if( flowElement instanceof Tap )
return Tap.id( (Tap) flowElement );
String id = Util.returnInstanceFieldIfExistsSafe( flowElement, "id" );
if( id != null )
return id;
throw new IllegalArgumentException( "id not supported for: " + flowElement.getClass().getCanonicalName() );
}
代码示例来源:origin: cwensel/cascading
};
ApplicationId appId = Util.returnInstanceFieldIfExistsSafe( dagClient, "appId" );
String dagId = Util.returnInstanceFieldIfExistsSafe( dagClient, "dagId" );
TezConfiguration conf = Util.returnInstanceFieldIfExistsSafe( dagClient, "conf" );
FrameworkClient frameworkClient = Util.returnInstanceFieldIfExistsSafe( dagClient, "frameworkClient" );
代码示例来源:origin: cascading/cascading-hadoop2-tez-stats
};
ApplicationId appId = Util.returnInstanceFieldIfExistsSafe( dagClient, "appId" );
String dagId = Util.returnInstanceFieldIfExistsSafe( dagClient, "dagId" );
TezConfiguration conf = Util.returnInstanceFieldIfExistsSafe( dagClient, "conf" );
FrameworkClient frameworkClient = Util.returnInstanceFieldIfExistsSafe( dagClient, "frameworkClient" );
代码示例来源:origin: cwensel/cascading
public static void setSourcePathForSplit( MRInput input, MRReader reader, Configuration configuration )
{
Path path = null;
if( Util.returnInstanceFieldIfExistsSafe( input, "useNewApi" ) )
{
org.apache.hadoop.mapreduce.InputSplit newInputSplit = (org.apache.hadoop.mapreduce.InputSplit) reader.getSplit();
if( newInputSplit instanceof org.apache.hadoop.mapreduce.lib.input.FileSplit )
path = ( (org.apache.hadoop.mapreduce.lib.input.FileSplit) newInputSplit ).getPath();
}
else
{
org.apache.hadoop.mapred.InputSplit oldInputSplit = (org.apache.hadoop.mapred.InputSplit) reader.getSplit();
if( oldInputSplit instanceof org.apache.hadoop.mapred.FileSplit )
path = ( (org.apache.hadoop.mapred.FileSplit) oldInputSplit ).getPath();
}
if( path != null )
configuration.set( FileType.CASCADING_SOURCE_PATH, path.toString() );
}
代码示例来源:origin: cascading/cascading-hadoop2-tez
public static void setSourcePathForSplit( MRInput input, MRReader reader, Configuration configuration )
{
Path path = null;
if( Util.returnInstanceFieldIfExistsSafe( input, "useNewApi" ) )
{
org.apache.hadoop.mapreduce.InputSplit newInputSplit = (org.apache.hadoop.mapreduce.InputSplit) reader.getSplit();
if( newInputSplit instanceof org.apache.hadoop.mapreduce.lib.input.FileSplit )
path = ( (org.apache.hadoop.mapreduce.lib.input.FileSplit) newInputSplit ).getPath();
}
else
{
org.apache.hadoop.mapred.InputSplit oldInputSplit = (org.apache.hadoop.mapred.InputSplit) reader.getSplit();
if( oldInputSplit instanceof org.apache.hadoop.mapred.FileSplit )
path = ( (org.apache.hadoop.mapred.FileSplit) oldInputSplit ).getPath();
}
if( path != null )
configuration.set( FileType.CASCADING_SOURCE_PATH, path.toString() );
}
代码示例来源:origin: cascading/cascading-hadoop2-tez
protected void internalNonBlockingStart() throws IOException
{
try
{
if( !isTimelineServiceEnabled( jobConfiguration ) )
flowStep.logWarn( "'" + YarnConfiguration.TIMELINE_SERVICE_ENABLED + "' is disabled, please enable to capture detailed metrics of completed flows, this may require starting the YARN timeline server daemon" );
TezConfiguration workingConf = new TezConfiguration( jobConfiguration );
// this could be problematic
flowStep.logInfo( "tez session mode enabled: " + workingConf.getBoolean( TezConfiguration.TEZ_AM_SESSION_MODE, TezConfiguration.TEZ_AM_SESSION_MODE_DEFAULT ) );
prepareEnsureStagingDir( workingConf );
tezClient = TezClient.create( flowStep.getName(), workingConf, ( (Hadoop2TezFlowStep) flowStep ).getAllLocalResources(), null );
tezClient.start();
dagClient = tezClient.submitDAG( dag );
dagId = Util.returnInstanceFieldIfExistsSafe( dagClient, "dagId" );
flowStep.logInfo( "submitted tez dag to app master: {}, with dag id: {}", tezClient.getAppMasterApplicationId(), dagId );
}
catch( TezException exception )
{
this.throwable = exception;
throw new CascadingException( exception );
}
}
代码示例来源:origin: cwensel/cascading
protected void internalNonBlockingStart() throws IOException
{
try
{
if( !isTimelineServiceEnabled( jobConfiguration ) )
flowStep.logWarn( "'" + YarnConfiguration.TIMELINE_SERVICE_ENABLED + "' is disabled, please enable to capture detailed metrics of completed flows, this may require starting the YARN timeline server daemon" );
TezConfiguration workingConf = new TezConfiguration( jobConfiguration );
// this could be problematic
flowStep.logInfo( "tez session mode enabled: " + workingConf.getBoolean( TezConfiguration.TEZ_AM_SESSION_MODE, TezConfiguration.TEZ_AM_SESSION_MODE_DEFAULT ) );
prepareEnsureStagingDir( workingConf );
tezClient = TezClient.create( flowStep.getName(), workingConf, ( (Hadoop2TezFlowStep) flowStep ).getAllLocalResources(), null );
tezClient.start();
dagClient = tezClient.submitDAG( dag );
dagId = Util.returnInstanceFieldIfExistsSafe( dagClient, "dagId" );
flowStep.logInfo( "submitted tez dag to app master: {}, with dag id: {}", tezClient.getAppMasterApplicationId(), dagId );
}
catch( TezException exception )
{
this.throwable = exception;
throw new CascadingException( exception );
}
}
内容来源于网络,如有侵权,请联系作者删除!