本文整理了Java中cascading.tap.Tap.deleteResource()
方法的一些代码示例,展示了Tap.deleteResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tap.deleteResource()
方法的具体详情如下:
包路径:cascading.tap.Tap
类名称:Tap
方法名:deleteResource
[英]Method deleteResource deletes the resource represented by this instance.
[中]方法deleteResource删除此实例表示的资源。
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public boolean deleteResource(Object conf) throws IOException {
return actualTap.deleteResource(conf);
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( Config conf ) throws IOException
{
return original.deleteResource( conf );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( Config conf ) throws IOException
{
return keepParentOnDelete || parent.deleteResource( conf );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( FlowProcess<? extends Config> flowProcess ) throws IOException
{
return original.deleteResource( flowProcess );
}
代码示例来源:origin: cwensel/cascading
private boolean deleteParent( Properties conf ) throws IOException
{
return keepParentOnDelete || parent.deleteResource( conf );
}
代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop
@Override
public boolean deleteResource(Object conf) throws IOException {
return actualTap.deleteResource(conf);
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( FlowProcess<? extends TConfig> flowProcess ) throws IOException
{
return original.deleteResource( processProvider.apply( flowProcess ) );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( TConfig conf ) throws IOException
{
return original.deleteResource( configProvider.apply( conf ) );
}
代码示例来源:origin: cwensel/cascading
/**
* Method deleteResource deletes the resource represented by this instance.
*
* @param flowProcess of type FlowProcess
* @return boolean
* @throws IOException when the resource cannot be deleted
*/
public boolean deleteResource( FlowProcess<? extends Config> flowProcess ) throws IOException
{
return deleteResource( flowProcess.getConfig() );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean deleteResource( Config conf ) throws IOException
{
for( Tap tap : getTaps() )
{
if( !tap.deleteResource( conf ) )
return false;
}
return true;
}
代码示例来源:origin: cwensel/cascading
/**
* Method openForWrite opens the resource represented by this Tap instance for writing.
* <p>
* This method is for user application use and does honor the {@link SinkMode#REPLACE} settings. That is, if
* SinkMode is set to {@link SinkMode#REPLACE} the underlying resource will be deleted.
* <p>
* Note if {@link SinkMode#UPDATE} is set, the resource will not be deleted.
*
* @param flowProcess of type FlowProcess
* @return TupleEntryCollector
* @throws java.io.IOException when the resource cannot be opened
*/
public TupleEntryCollector openForWrite( FlowProcess<? extends Config> flowProcess ) throws IOException
{
if( isReplace() )
deleteResource( flowProcess );
return openForWrite( flowProcess, null );
}
代码示例来源:origin: cwensel/cascading
private void deleteOrFail( Tap tap ) throws IOException
{
if( !tap.resourceExists( getConfig() ) )
return;
if( !tap.deleteResource( getConfig() ) )
throw new FlowTapException( "unable to delete resource: " + tap.getFullIdentifier( getFlowProcess() ) );
}
代码示例来源:origin: cascading/cascading-hadoop2-mr1
protected void cleanIntermediateData( JobConf config, Tap sink )
{
if( sink.isTemporary() && ( getFlow().getFlowStats().isSuccessful() || getFlow().getRunID() == null ) )
{
try
{
sink.deleteResource( config );
}
catch( Exception exception )
{
// sink all exceptions, don't fail app
logWarn( "unable to remove temporary file: " + sink, exception );
}
}
else
{
cleanTapMetaData( config, sink );
}
}
代码示例来源:origin: cwensel/cascading
protected void cleanIntermediateData( JobConf config, Tap sink )
{
if( sink.isTemporary() && ( getFlow().getFlowStats().isSuccessful() || getFlow().getRunID() == null ) )
{
try
{
sink.deleteResource( config );
}
catch( Exception exception )
{
// sink all exceptions, don't fail app
logWarn( "unable to remove temporary file: " + sink, exception );
}
}
else
{
cleanTapMetaData( config, sink );
}
}
代码示例来源:origin: cascading/cascading-hadoop2-tez
@Override
public void clean( TezConfiguration config )
{
for( Tap sink : getSinkTaps() )
{
if( sink.isTemporary() && ( getFlow().getFlowStats().isSuccessful() || getFlow().getRunID() == null ) )
{
try
{
sink.deleteResource( config );
}
catch( Exception exception )
{
// sink all exceptions, don't fail app
logWarn( "unable to remove temporary file: " + sink, exception );
}
}
else
{
cleanTapMetaData( config, sink );
}
}
for( Tap tap : getTraps() )
cleanTapMetaData( config, tap );
}
代码示例来源:origin: cwensel/cascading
@Override
public void clean( TezConfiguration config )
{
for( Tap sink : getSinkTaps() )
{
if( sink.isTemporary() && ( getFlow().getFlowStats().isSuccessful() || getFlow().getRunID() == null ) )
{
try
{
sink.deleteResource( config );
}
catch( Exception exception )
{
// sink all exceptions, don't fail app
logWarn( "unable to remove temporary file: " + sink, exception );
}
}
else
{
cleanTapMetaData( config, sink );
}
}
for( Tap tap : getTraps() )
cleanTapMetaData( config, tap );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSkipStrategiesKeep() throws Exception
{
getPlatform().copyFromLocal( inputFileApache );
Tap source = getPlatform().getTextFile( inputFileApache );
// !!! enable replace
Tap sink = getPlatform().getTextFile( getOutputPath( "keep" ), SinkMode.KEEP );
Pipe pipe = new Pipe( "test" );
pipe = new Each( pipe, new Fields( "line" ), new RegexParser( new Fields( "ip" ), "^[^ ]*" ), new Fields( "ip" ) );
Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
sink.deleteResource( flow.getConfig() );
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
flow.complete();
assertTrue( "default skip", flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", new FlowSkipIfSinkExists().skipFlow( flow ) );
validateLength( flow.openSource(), 10 ); // validate source, this once, as a sanity check
validateLength( flow, 10, null );
}
代码示例来源:origin: cascading/cascading-platform
@Test
public void testSkipStrategiesKeep() throws Exception
{
getPlatform().copyFromLocal( inputFileApache );
Tap source = getPlatform().getTextFile( inputFileApache );
// !!! enable replace
Tap sink = getPlatform().getTextFile( getOutputPath( "keep" ), SinkMode.KEEP );
Pipe pipe = new Pipe( "test" );
pipe = new Each( pipe, new Fields( "line" ), new RegexParser( new Fields( "ip" ), "^[^ ]*" ), new Fields( "ip" ) );
Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
sink.deleteResource( flow.getConfig() );
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
flow.complete();
assertTrue( "default skip", flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", new FlowSkipIfSinkExists().skipFlow( flow ) );
validateLength( flow.openSource(), 10 ); // validate source, this once, as a sanity check
validateLength( flow, 10, null );
}
代码示例来源:origin: cascading/cascading-platform
@Test
public void testSkipStrategiesReplace() throws Exception
{
getPlatform().copyFromLocal( inputFileApache );
Tap source = getPlatform().getTextFile( inputFileApache );
// !!! enable replace
Tap sink = getPlatform().getTextFile( getOutputPath( "replace" ), SinkMode.REPLACE );
Pipe pipe = new Pipe( "test" );
pipe = new Each( pipe, new Fields( "line" ), new RegexParser( new Fields( "ip" ), "^[^ ]*" ), new Fields( "ip" ) );
Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
sink.deleteResource( flow.getConfig() );
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
flow.complete();
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
FlowSkipStrategy old = flow.getFlowSkipStrategy();
FlowSkipStrategy replaced = flow.setFlowSkipStrategy( new FlowSkipIfSinkExists() );
assertTrue( "not same instance", old == replaced );
validateLength( flow.openSource(), 10 ); // validate source, this once, as a sanity check
validateLength( flow, 10, null );
}
代码示例来源:origin: cwensel/cascading
@Test
public void testSkipStrategiesReplace() throws Exception
{
getPlatform().copyFromLocal( inputFileApache );
Tap source = getPlatform().getTextFile( inputFileApache );
// !!! enable replace
Tap sink = getPlatform().getTextFile( getOutputPath( "replace" ), SinkMode.REPLACE );
Pipe pipe = new Pipe( "test" );
pipe = new Each( pipe, new Fields( "line" ), new RegexParser( new Fields( "ip" ), "^[^ ]*" ), new Fields( "ip" ) );
Flow flow = getPlatform().getFlowConnector().connect( source, sink, pipe );
sink.deleteResource( flow.getConfig() );
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
flow.complete();
assertTrue( "default skip", !flow.getFlowSkipStrategy().skipFlow( flow ) );
assertTrue( "exist skip", !new FlowSkipIfSinkExists().skipFlow( flow ) );
FlowSkipStrategy old = flow.getFlowSkipStrategy();
FlowSkipStrategy replaced = flow.setFlowSkipStrategy( new FlowSkipIfSinkExists() );
assertTrue( "not same instance", old == replaced );
validateLength( flow.openSource(), 10 ); // validate source, this once, as a sanity check
validateLength( flow, 10, null );
}
内容来源于网络,如有侵权,请联系作者删除!