protected void handleReThrowableException( String message, Throwable throwable ) { LOG.error( message, throwable ); if( throwable instanceof Error ) throw (Error) throwable; else if( throwable instanceof RuntimeException ) throw (RuntimeException) throwable; else throw new DuctException( message, throwable ); }
/** * Method getTrapCollectorFor will return a new {@link TupleEntryCollector} if one hasn't previously * been created for the given trap Tap. * * @param trap * @return TupleEntryCollector */ public TupleEntryCollector getTrapCollectorFor( Tap trap ) { Map<Tap, TupleEntryCollector> trapCollectors = getTrapCollectors(); TupleEntryCollector trapCollector = trapCollectors.get( trap ); if( trapCollector == null ) { try { trapCollector = openTrapForWrite( trap ); trapCollectors.put( trap, trapCollector ); } catch( IOException exception ) { throw new DuctException( exception ); } } return trapCollector; }
handleException( new DuctException( "internal error", throwable ), null ); continue;
@Override public void prepare() { try { // todo: pass the resolved fields down collector = sink.openForWrite( flowProcess, getOutput() ); if( sink.getSinkFields().isAll() ) { Fields fields = getIncomingScopes().get( 0 ).getIncomingTapFields(); collector.setFields( fields ); } } catch( IOException exception ) { throw new DuctException( "failed opening sink", exception ); } }
handleException( new DuctException( "internal error", throwable ), null ); continue;
handleException(new DuctException("internal error", throwable), null); continue;
handleException( new DuctException( "internal error", throwable ), null ); continue;
handleException( new DuctException( "internal error", throwable ), null );
handleException( new DuctException( "internal error", throwable ), null );
@Override public void receive( Duct previous, int ordinal, TupleEntry tupleEntry ) { try { timedAdd( StepCounters.Write_Duration, tupleEntry ); flowProcess.increment( StepCounters.Tuples_Written, 1 ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, tupleEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + tupleEntry.getTuple().print(), throwable ), tupleEntry ); } }
throw new DuctException( "failure resolving tuple entry", throwable );
@Override public void run(Object input) throws Throwable { if(!this.nextStarted) { next.start(this); this.nextStarted = true; } try { Tuple tuple = (Tuple)input; tupleEntry.setTuple(tuple); flowProcess.increment( StepCounters.Tuples_Read, 1 ); flowProcess.increment(SliceCounters.Tuples_Read, 1); } catch( OutOfMemoryError error ) { handleReThrowableException("out of memory, try increasing task memory allocation", error); } catch( CascadingException exception ) { handleException(exception, null); } catch( Throwable throwable ) { handleException(new DuctException("internal error", throwable), null); } next.receive( this, tupleEntry ); } }
@Override public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { try { keyTuple.reset( incomingEntry.getTuple() ); collector.collect( keyTuple, ValueTuple.NULL ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }
@Override public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { try { keyTuple.reset( incomingEntry.getTuple() ); collector.collect( keyTuple, ValueTuple.NULL ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }
@Override public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { try { Tuple tuple = incomingEntry.getTuple(); keyTuple.reset( tuple ); collector.collect( keyTuple, ValueTuple.NULL ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }
@Override public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { try { Tuple tuple = incomingEntry.getTuple(); keyTuple.reset( tuple ); collector.collect( keyTuple, ValueTuple.NULL ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }
public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { // create a view over the incoming tuple Tuple groupTupleView = keyBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ); // reset keyTuple via groupTuple or groupSortTuple if( sortFields == null ) groupTuple.reset( groupTupleView ); else groupSortTuple.reset( groupTupleView, sortBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ) ); valueTuple.reset( valuesBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ) ); try { // keyTuple is a reference to either groupTuple or groupSortTuple wrapGroupingAndCollect( previous, ordinal, (Tuple) valueTuple, keyTuple ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }
public void receive( Duct previous, int ordinal, TupleEntry incomingEntry ) { // create a view over the incoming tuple Tuple groupTupleView = keyBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ); // reset keyTuple via groupTuple or groupSortTuple if( sortFields == null ) groupTuple.reset( groupTupleView ); else groupSortTuple.reset( groupTupleView, sortBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ) ); valueTuple.reset( valuesBuilder[ ordinal ].makeResult( incomingEntry.getTuple(), null ) ); try { // keyTuple is a reference to either groupTuple or groupSortTuple wrapGroupingAndCollect( previous, ordinal, (Tuple) valueTuple, keyTuple ); flowProcess.increment( SliceCounters.Tuples_Written, 1 ); } catch( OutOfMemoryError error ) { handleReThrowableException( "out of memory, try increasing task memory allocation", error ); } catch( CascadingException exception ) { handleException( exception, incomingEntry ); } catch( Throwable throwable ) { handleException( new DuctException( "internal error: " + incomingEntry.getTuple().print(), throwable ), incomingEntry ); } }