idx
int64 0
41.2k
| question
stringlengths 73
5.81k
| target
stringlengths 5
918
|
|---|---|---|
2,000
|
public synchronized void onRestart ( final StartTime startTime , final List < EventHandler < DriverRestarted > > orderedHandlers ) { if ( this . state == DriverRestartState . BEGAN ) { restartEvaluators = driverRuntimeRestartManager . getPreviousEvaluators ( ) ; final DriverRestarted restartedInfo = new DriverRestartedImpl ( resubmissionAttempts , startTime , restartEvaluators ) ; for ( final EventHandler < DriverRestarted > handler : orderedHandlers ) { handler . onNext ( restartedInfo ) ; } this . state = DriverRestartState . IN_PROGRESS ; } else { final String errMsg = "Should not be setting the set of expected alive evaluators more than once." ; LOG . log ( Level . SEVERE , errMsg ) ; throw new DriverFatalRuntimeException ( errMsg ) ; } driverRuntimeRestartManager . informAboutEvaluatorFailures ( getFailedEvaluators ( ) ) ; if ( driverRestartEvaluatorRecoverySeconds != Integer . MAX_VALUE ) { restartCompletedTimer . schedule ( new TimerTask ( ) { public void run ( ) { onDriverRestartCompleted ( true ) ; } } , driverRestartEvaluatorRecoverySeconds * 1000L ) ; } }
|
Recovers the list of alive and failed evaluators and inform the driver restart handlers and inform the evaluator failure handlers based on the specific runtime . Also sets the expected amount of evaluators to report back as alive to the job driver .
|
2,001
|
public synchronized boolean onRecoverEvaluator ( final String evaluatorId ) { if ( getStateOfPreviousEvaluator ( evaluatorId ) . isFailedOrNotExpected ( ) ) { final String errMsg = "Evaluator with evaluator ID " + evaluatorId + " not expected to be alive." ; LOG . log ( Level . SEVERE , errMsg ) ; throw new DriverFatalRuntimeException ( errMsg ) ; } if ( getStateOfPreviousEvaluator ( evaluatorId ) != EvaluatorRestartState . EXPECTED ) { LOG . log ( Level . WARNING , "Evaluator with evaluator ID " + evaluatorId + " added to the set" + " of recovered evaluators more than once. Ignoring second add..." ) ; return false ; } setEvaluatorReported ( evaluatorId ) ; if ( haveAllExpectedEvaluatorsReported ( ) ) { onDriverRestartCompleted ( false ) ; } return true ; }
|
Indicate that this Driver has re - established the connection with one more Evaluator of a previous run .
|
2,002
|
private synchronized void onDriverRestartCompleted ( final boolean isTimedOut ) { if ( this . state != DriverRestartState . COMPLETED ) { final Set < String > outstandingEvaluatorIds = getOutstandingEvaluatorsAndMarkExpired ( ) ; driverRuntimeRestartManager . informAboutEvaluatorFailures ( outstandingEvaluatorIds ) ; this . state = DriverRestartState . COMPLETED ; final DriverRestartCompleted driverRestartCompleted = new DriverRestartCompletedImpl ( System . currentTimeMillis ( ) , isTimedOut ) ; for ( final EventHandler < DriverRestartCompleted > serviceRestartCompletedHandler : this . serviceDriverRestartCompletedHandlers ) { serviceRestartCompletedHandler . onNext ( driverRestartCompleted ) ; } for ( final EventHandler < DriverRestartCompleted > restartCompletedHandler : this . driverRestartCompletedHandlers ) { restartCompletedHandler . onNext ( driverRestartCompleted ) ; } LOG . log ( Level . FINE , "Restart completed. Evaluators that have not reported back are: " + outstandingEvaluatorIds ) ; } restartCompletedTimer . cancel ( ) ; }
|
Sets the driver restart status to be completed if not yet set and notifies the restart completed event handlers .
|
2,003
|
private Set < String > getOutstandingEvaluatorsAndMarkExpired ( ) { final Set < String > outstanding = new HashSet < > ( ) ; for ( final String previousEvaluatorId : restartEvaluators . getEvaluatorIds ( ) ) { if ( getStateOfPreviousEvaluator ( previousEvaluatorId ) == EvaluatorRestartState . EXPECTED ) { outstanding . add ( previousEvaluatorId ) ; setEvaluatorExpired ( previousEvaluatorId ) ; } } return outstanding ; }
|
Gets the outstanding evaluators that have not yet reported back and mark them as expired .
|
2,004
|
private ConstructorDef < ? > parseConstructorDef ( final AvroConstructorDef def , final boolean isInjectable ) { final List < ConstructorArg > args = new ArrayList < > ( ) ; for ( final AvroConstructorArg arg : def . getConstructorArgs ( ) ) { args . add ( new ConstructorArgImpl ( getString ( arg . getFullArgClassName ( ) ) , getString ( arg . getNamedParameterName ( ) ) , arg . getIsInjectionFuture ( ) ) ) ; } return new ConstructorDefImpl < > ( getString ( def . getFullClassName ( ) ) , args . toArray ( new ConstructorArg [ 0 ] ) , isInjectable ) ; }
|
Parse the constructor definition .
|
2,005
|
private void parseSubHierarchy ( final Node parent , final AvroNode n ) { final Node parsed ; if ( n . getPackageNode ( ) != null ) { parsed = new PackageNodeImpl ( parent , getString ( n . getName ( ) ) , getString ( n . getFullName ( ) ) ) ; } else if ( n . getNamedParameterNode ( ) != null ) { final AvroNamedParameterNode np = n . getNamedParameterNode ( ) ; parsed = new NamedParameterNodeImpl < > ( parent , getString ( n . getName ( ) ) , getString ( n . getFullName ( ) ) , getString ( np . getFullArgClassName ( ) ) , getString ( np . getSimpleArgClassName ( ) ) , np . getIsSet ( ) , np . getIsList ( ) , getString ( np . getDocumentation ( ) ) , getString ( np . getShortName ( ) ) , getStringArray ( np . getInstanceDefault ( ) ) ) ; } else if ( n . getClassNode ( ) != null ) { final AvroClassNode cn = n . getClassNode ( ) ; final List < ConstructorDef < ? > > injectableConstructors = new ArrayList < > ( ) ; final List < ConstructorDef < ? > > allConstructors = new ArrayList < > ( ) ; for ( final AvroConstructorDef injectable : cn . getInjectableConstructors ( ) ) { final ConstructorDef < ? > def = parseConstructorDef ( injectable , true ) ; injectableConstructors . add ( def ) ; allConstructors . add ( def ) ; } for ( final AvroConstructorDef other : cn . getOtherConstructors ( ) ) { final ConstructorDef < ? > def = parseConstructorDef ( other , false ) ; allConstructors . add ( def ) ; } @ SuppressWarnings ( "unchecked" ) final ConstructorDef < Object > [ ] dummy = new ConstructorDef [ 0 ] ; parsed = new ClassNodeImpl < > ( parent , getString ( n . getName ( ) ) , getString ( n . getFullName ( ) ) , cn . getIsUnit ( ) , cn . getIsInjectionCandidate ( ) , cn . getIsExternalConstructor ( ) , injectableConstructors . toArray ( dummy ) , allConstructors . toArray ( dummy ) , getString ( cn . getDefaultImplementation ( ) ) ) ; } else { throw new IllegalStateException ( "Bad avro node: got abstract node" + n ) ; } for ( final AvroNode child : n . getChildren ( ) ) { parseSubHierarchy ( parsed , child ) ; } }
|
Register the classes recursively .
|
2,006
|
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private void wireUpInheritanceRelationships ( final AvroNode n ) { if ( n . getClassNode ( ) != null ) { final AvroClassNode cn = n . getClassNode ( ) ; final ClassNode iface ; try { iface = ( ClassNode ) getNode ( getString ( n . getFullName ( ) ) ) ; } catch ( final NameResolutionException e ) { final String errorMessage = new StringBuilder ( ) . append ( "When reading avro node " ) . append ( n . getFullName ( ) ) . append ( " does not exist. Full record is " ) . append ( n ) . toString ( ) ; throw new IllegalStateException ( errorMessage , e ) ; } for ( final CharSequence impl : cn . getImplFullNames ( ) ) { try { iface . putImpl ( ( ClassNode ) getNode ( getString ( impl ) ) ) ; } catch ( final NameResolutionException e ) { final String errorMessage = new StringBuilder ( ) . append ( "When reading avro node " ) . append ( n ) . append ( " refers to non-existent implementation:" ) . append ( impl ) . toString ( ) ; throw new IllegalStateException ( errorMessage , e ) ; } catch ( final ClassCastException e ) { try { final String errorMessage = new StringBuilder ( ) . append ( "When reading avro node " ) . append ( n ) . append ( " found implementation" ) . append ( getNode ( getString ( impl ) ) ) . append ( " which is not a ClassNode!" ) . toString ( ) ; throw new IllegalStateException ( errorMessage , e ) ; } catch ( final NameResolutionException e2 ) { final String errorMessage = new StringBuilder ( ) . append ( "Got 'cant happen' exception when producing error message for " ) . append ( e ) . toString ( ) ; throw new IllegalStateException ( errorMessage , e2 ) ; } } } } for ( final AvroNode child : n . getChildren ( ) ) { wireUpInheritanceRelationships ( child ) ; } }
|
Register the implementation for the ClassNode recursively .
|
2,007
|
private String [ ] getStringArray ( final List < CharSequence > charSeqList ) { final int length = charSeqList . size ( ) ; final String [ ] stringArray = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { stringArray [ i ] = getString ( charSeqList . get ( i ) ) ; } return stringArray ; }
|
Convert the CharSequence list into the String array .
|
2,008
|
public static LoggingScope getNewLoggingScope ( final Level logLevel , final String msg ) { return new LoggingScopeImpl ( LOG , logLevel , msg ) ; }
|
Get a new instance of LoggingScope with specified log level .
|
2,009
|
public LoggingScope getNewLoggingScope ( final String msg , final Object [ ] params ) { return new LoggingScopeImpl ( LOG , logLevel , msg , params ) ; }
|
Get a new instance of LoggingScope with msg and params through new .
|
2,010
|
public byte [ ] write ( final SpecificRecord message , final long sequence ) { final String classId = getClassId ( message . getClass ( ) ) ; try ( final ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ) { LOG . log ( Level . FINEST , "Serializing message: {0}" , classId ) ; final IMessageSerializer serializer = this . nameToSerializerMap . get ( classId ) ; if ( serializer != null ) { serializer . serialize ( outputStream , message , sequence ) ; } return outputStream . toByteArray ( ) ; } catch ( final IOException e ) { throw new RuntimeException ( "Failure writing message: " + classId , e ) ; } }
|
Marshall the input message to a byte array .
|
2,011
|
public void read ( final byte [ ] messageBytes , final MultiObserver observer ) { try ( final InputStream inputStream = new ByteArrayInputStream ( messageBytes ) ) { final BinaryDecoder decoder = DecoderFactory . get ( ) . binaryDecoder ( inputStream , null ) ; final Header header = this . headerReader . read ( null , decoder ) ; final String classId = header . getClassName ( ) . toString ( ) ; LOG . log ( Level . FINEST , "Deserializing Avro message: {0}" , classId ) ; final IMessageDeserializer deserializer = this . nameToDeserializerMap . get ( classId ) ; if ( deserializer != null ) { deserializer . deserialize ( decoder , observer , header . getSequence ( ) ) ; } else { throw new RuntimeException ( "Request to deserialize unknown message type: " + classId ) ; } } catch ( final IOException e ) { throw new RuntimeException ( "Failure reading message" , e ) ; } catch ( final InvocationTargetException | IllegalAccessException e ) { throw new RuntimeException ( "Error deserializing message body" , e ) ; } }
|
Read a message from the input byte stream and send it to the event handler .
|
2,012
|
private static String getAbsolutePath ( final String relativePath ) { final File outputFile = new File ( relativePath ) ; return outputFile . getAbsolutePath ( ) ; }
|
transform the given relative path into the absolute path based on the current directory where a user runs the demo .
|
2,013
|
private void addYarnRuntimeDefinition ( final AvroYarnJobSubmissionParameters yarnJobSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { final Configuration yarnDriverConfiguration = createYarnConfiguration ( yarnJobSubmissionParams , jobSubmissionParameters ) ; builder . addRuntime ( yarnDriverConfiguration , RuntimeIdentifier . RUNTIME_NAME ) ; }
|
Adds yarn runtime definitions to the builder .
|
2,014
|
private void addDummyYarnRuntimeDefinition ( final AvroYarnJobSubmissionParameters yarnJobSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { final Configuration yarnDriverConfiguration = createYarnConfiguration ( yarnJobSubmissionParams , jobSubmissionParameters ) ; builder . addRuntime ( yarnDriverConfiguration , DUMMY_YARN_RUNTIME ) ; }
|
Adds yarn runtime definitions to the builder with a dummy name . This is needed to initialze yarn runtme that registers with RM but does not allows submitting evaluators as evaluator submissions submits to Yarn runtime .
|
2,015
|
private void addLocalRuntimeDefinition ( final AvroLocalAppSubmissionParameters localAppSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { final Configuration localModule = LocalDriverConfiguration . CONF . set ( LocalDriverConfiguration . MAX_NUMBER_OF_EVALUATORS , localAppSubmissionParams . getMaxNumberOfConcurrentEvaluators ( ) ) . set ( LocalDriverConfiguration . ROOT_FOLDER , "." ) . set ( LocalDriverConfiguration . JVM_HEAP_SLACK , 0.0 ) . set ( LocalDriverConfiguration . CLIENT_REMOTE_IDENTIFIER , ClientRemoteIdentifier . NONE ) . set ( LocalDriverConfiguration . JOB_IDENTIFIER , jobSubmissionParameters . getJobId ( ) . toString ( ) ) . set ( LocalDriverConfiguration . RUNTIME_NAMES , org . apache . reef . runtime . local . driver . RuntimeIdentifier . RUNTIME_NAME ) . build ( ) ; builder . addRuntime ( localModule , org . apache . reef . runtime . local . driver . RuntimeIdentifier . RUNTIME_NAME ) ; }
|
Adds local runtime definitions to the builder .
|
2,016
|
String writeDriverConfigurationFile ( final String bootstrapJobArgsLocation , final String bootstrapAppArgsLocation ) throws IOException { final File bootstrapJobArgsFile = new File ( bootstrapJobArgsLocation ) . getCanonicalFile ( ) ; final File bootstrapAppArgsFile = new File ( bootstrapAppArgsLocation ) ; final AvroYarnJobSubmissionParameters yarnBootstrapJobArgs = this . avroYarnJobSubmissionParametersSerializer . fromFile ( bootstrapJobArgsFile ) ; final AvroMultiRuntimeAppSubmissionParameters multiruntimeBootstrapAppArgs = this . avroMultiRuntimeAppSubmissionParametersSerializer . fromFile ( bootstrapAppArgsFile ) ; final String driverConfigPath = reefFileNames . getDriverConfigurationPath ( ) ; this . configurationSerializer . toFile ( getMultiRuntimeDriverConfiguration ( yarnBootstrapJobArgs , multiruntimeBootstrapAppArgs ) , new File ( driverConfigPath ) ) ; return driverConfigPath ; }
|
Writes the driver configuration files to the provided location .
|
2,017
|
public final < T > CommandLine processCommandLine ( final String [ ] args , final Class < ? extends Name < ? > > ... argClasses ) throws IOException , BindException { for ( final Class < ? extends Name < ? > > c : argClasses ) { registerShortNameOfClass ( c ) ; } final Options o = getCommandLineOptions ( ) ; o . addOption ( new Option ( "?" , "help" ) ) ; final Parser g = new GnuParser ( ) ; final org . apache . commons . cli . CommandLine cl ; try { cl = g . parse ( o , args ) ; } catch ( final ParseException e ) { throw new IOException ( "Could not parse config file" , e ) ; } if ( cl . hasOption ( "?" ) ) { new HelpFormatter ( ) . printHelp ( "reef" , o ) ; return null ; } for ( final Option option : cl . getOptions ( ) ) { final String shortName = option . getOpt ( ) ; final String value = option . getValue ( ) ; if ( applicationOptions . containsKey ( option ) ) { applicationOptions . get ( option ) . process ( option ) ; } else { try { conf . bind ( shortNames . get ( shortName ) , value ) ; } catch ( final BindException e ) { throw new BindException ( "Could not bind shortName " + shortName + " to value " + value , e ) ; } } } return this ; }
|
Process command line arguments .
|
2,018
|
@ SuppressWarnings ( "checkstyle:avoidhidingcauseexception" ) public static ConfigurationBuilder parseToConfigurationBuilder ( final String [ ] args , final Class < ? extends Name < ? > > ... argClasses ) throws ParseException { final CommandLine commandLine ; try { commandLine = new CommandLine ( ) . processCommandLine ( args , argClasses ) ; } catch ( final IOException e ) { throw new ParseException ( e . getMessage ( ) ) ; } if ( commandLine == null ) { throw new ParseException ( "Unable to parse the command line and the parser returned null." ) ; } else { return commandLine . getBuilder ( ) ; } }
|
ParseException constructor does not accept a cause Exception hence
|
2,019
|
public static List < Integer > getUniformCounts ( final int elementCount , final int taskCount ) { final int quotient = elementCount / taskCount ; final int remainder = elementCount % taskCount ; final List < Integer > retList = new ArrayList < > ( ) ; for ( int taskIndex = 0 ; taskIndex < taskCount ; taskIndex ++ ) { if ( taskIndex < remainder ) { retList . add ( quotient + 1 ) ; } else { retList . add ( quotient ) ; } } return retList ; }
|
Uniformly distribute a number of elements across a number of Tasks and return a list of counts . If uniform distribution is impossible then some Tasks will receive one more element than others . The sequence of the number of elements for each Task is non - increasing .
|
2,020
|
public void completed ( final int taskletId , final TOutput result ) { try { completedTasklets ( result , Collections . singletonList ( taskletId ) ) ; } catch ( final InterruptedException e ) { throw new RuntimeException ( e ) ; } }
|
A Tasklet associated with the aggregation has completed .
|
2,021
|
public void aggregationCompleted ( final List < Integer > taskletIds , final TOutput result ) { try { completedTasklets ( result , taskletIds ) ; } catch ( final InterruptedException e ) { throw new RuntimeException ( e ) ; } }
|
Aggregation has completed for a list of Tasklets with an aggregated result .
|
2,022
|
public void threwException ( final int taskletId , final Exception exception ) { try { failedTasklets ( exception , Collections . singletonList ( taskletId ) ) ; } catch ( final InterruptedException e ) { throw new RuntimeException ( e ) ; } }
|
A Tasklet associated with the aggregation has failed .
|
2,023
|
public void aggregationThrewException ( final List < Integer > taskletIds , final Exception exception ) { try { failedTasklets ( exception , taskletIds ) ; } catch ( final InterruptedException e ) { throw new RuntimeException ( e ) ; } }
|
A list of Tasklets has failed during aggregation phase .
|
2,024
|
private void completedTasklets ( final TOutput output , final List < Integer > taskletIds ) throws InterruptedException { final List < TInput > inputs = getInputs ( taskletIds ) ; final AggregateResult result = new AggregateResult ( output , inputs ) ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { public void run ( ) { callbackHandler . onSuccess ( result ) ; } } ) ; } resultQueue . put ( new ImmutablePair < > ( taskletIds , result ) ) ; }
|
Create and queue result for Tasklets that are expected and invoke callback .
|
2,025
|
private void failedTasklets ( final Exception exception , final List < Integer > taskletIds ) throws InterruptedException { final List < TInput > inputs = getInputs ( taskletIds ) ; final AggregateResult failure = new AggregateResult ( exception , inputs ) ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { public void run ( ) { callbackHandler . onFailure ( new VortexAggregateException ( exception , inputs ) ) ; } } ) ; } resultQueue . put ( new ImmutablePair < > ( taskletIds , failure ) ) ; }
|
Create and queue result for failed Tasklets that are expected and invokes callback .
|
2,026
|
private List < TInput > getInputs ( final List < Integer > taskletIds ) { final List < TInput > inputList = new ArrayList < > ( taskletIds . size ( ) ) ; for ( final int taskletId : taskletIds ) { inputList . add ( taskletIdInputMap . get ( taskletId ) ) ; } return inputList ; }
|
Gets the inputs on Tasklet aggregation completion .
|
2,027
|
public void onNext ( final ResourceLaunchEvent resourceLaunchEvent ) { LOG . log ( Level . FINEST , "Got ResourceLaunchEvent in AzureBatchResourceLaunchHandler" ) ; this . azureBatchResourceManager . onResourceLaunched ( resourceLaunchEvent ) ; }
|
This method is called when a new resource is requested .
|
2,028
|
public synchronized void fireEvaluatorAllocatedEvent ( ) { if ( this . stateManager . isAllocated ( ) && this . allocationNotFired ) { final AllocatedEvaluator allocatedEvaluator = new AllocatedEvaluatorImpl ( this , this . remoteManager . getMyIdentifier ( ) , this . configurationSerializer , getJobIdentifier ( ) , this . loggingScopeFactory , this . evaluatorConfigurationProviders ) ; LOG . log ( Level . FINEST , "Firing AllocatedEvaluator event for Evaluator with ID [{0}]" , this . evaluatorId ) ; this . messageDispatcher . onEvaluatorAllocated ( allocatedEvaluator ) ; this . allocationNotFired = false ; } else { LOG . log ( Level . WARNING , "AllocatedEvaluator event fired more than once." ) ; } }
|
Fires the EvaluatorAllocatedEvent to the handlers . Can only be done once .
|
2,029
|
public void onEvaluatorException ( final EvaluatorException exception ) { synchronized ( this . evaluatorDescriptor ) { if ( this . stateManager . isCompleted ( ) ) { LOG . log ( Level . FINE , "Ignoring an exception received for Evaluator {0} which is already in state {1}." , new Object [ ] { this . getId ( ) , this . stateManager } ) ; return ; } LOG . log ( Level . WARNING , "Failed evaluator: " + getId ( ) , exception ) ; try { final List < FailedContext > failedContextList = this . contextRepresenters . getFailedContextsForEvaluatorFailure ( ) ; final Optional < FailedTask > failedTaskOptional ; if ( this . task . isPresent ( ) ) { final String taskId = this . task . get ( ) . getId ( ) ; final Optional < ActiveContext > evaluatorContext = Optional . empty ( ) ; final Optional < byte [ ] > bytes = Optional . empty ( ) ; final Optional < Throwable > taskException = Optional . < Throwable > of ( new Exception ( "Evaluator crash" ) ) ; final String message = "Evaluator crash" ; final Optional < String > description = Optional . empty ( ) ; final FailedTask failedTask = new FailedTask ( taskId , message , description , taskException , bytes , evaluatorContext ) ; failedTaskOptional = Optional . of ( failedTask ) ; } else { failedTaskOptional = Optional . empty ( ) ; } final FailedEvaluator failedEvaluator = new FailedEvaluatorImpl ( exception , failedContextList , failedTaskOptional , this . evaluatorId ) ; if ( driverRestartManager . getEvaluatorRestartState ( evaluatorId ) . isFailedOrExpired ( ) ) { this . messageDispatcher . onDriverRestartEvaluatorFailed ( failedEvaluator ) ; } else { this . messageDispatcher . onEvaluatorFailed ( failedEvaluator ) ; } } catch ( final Exception e ) { LOG . log ( Level . SEVERE , "Exception while handling FailedEvaluator" , e ) ; } finally { this . stateManager . setFailed ( ) ; this . close ( ) ; } } }
|
EvaluatorException will trigger is FailedEvaluator and state transition to FAILED .
|
2,030
|
public void onEvaluatorHeartbeatMessage ( final RemoteMessage < EvaluatorRuntimeProtocol . EvaluatorHeartbeatProto > evaluatorHeartbeatProtoRemoteMessage ) { final EvaluatorRuntimeProtocol . EvaluatorHeartbeatProto evaluatorHeartbeatProto = evaluatorHeartbeatProtoRemoteMessage . getMessage ( ) ; LOG . log ( Level . FINEST , "Evaluator heartbeat: {0}" , evaluatorHeartbeatProto ) ; synchronized ( this . evaluatorDescriptor ) { if ( this . stateManager . isCompleted ( ) ) { LOG . log ( Level . FINE , "Ignoring a heartbeat received for Evaluator {0} which is already in state {1}." , new Object [ ] { this . getId ( ) , this . stateManager } ) ; return ; } else if ( this . stateManager . isAvailable ( ) ) { this . sanityChecker . check ( this . evaluatorId , evaluatorHeartbeatProto . getTimestamp ( ) ) ; final String evaluatorRID = evaluatorHeartbeatProtoRemoteMessage . getIdentifier ( ) . toString ( ) ; final EvaluatorRestartState evaluatorRestartState = this . driverRestartManager . getEvaluatorRestartState ( this . evaluatorId ) ; if ( this . stateManager . isSubmitted ( ) || evaluatorRestartState == EvaluatorRestartState . REPORTED || evaluatorRestartState == EvaluatorRestartState . EXPIRED ) { this . evaluatorControlHandler . setRemoteID ( evaluatorRID ) ; if ( evaluatorRestartState == EvaluatorRestartState . EXPIRED ) { return ; } this . stateManager . setRunning ( ) ; LOG . log ( Level . FINEST , "Evaluator {0} is running" , this . evaluatorId ) ; if ( evaluatorRestartState == EvaluatorRestartState . REPORTED ) { this . driverRestartManager . setEvaluatorReregistered ( this . evaluatorId ) ; } } } final long messageSequenceNumber = evaluatorHeartbeatProto . getTimestamp ( ) ; if ( evaluatorHeartbeatProto . hasEvaluatorStatus ( ) ) { this . onEvaluatorStatusMessage ( new EvaluatorStatusPOJO ( evaluatorHeartbeatProto . getEvaluatorStatus ( ) ) ) ; } final boolean informClientOfNewContexts = ! evaluatorHeartbeatProto . hasTaskStatus ( ) ; final List < ContextStatusPOJO > contextStatusList = new ArrayList < > ( ) ; for ( ReefServiceProtos . ContextStatusProto proto : evaluatorHeartbeatProto . getContextStatusList ( ) ) { contextStatusList . add ( new ContextStatusPOJO ( proto , messageSequenceNumber ) ) ; } this . contextRepresenters . onContextStatusMessages ( contextStatusList , informClientOfNewContexts ) ; if ( evaluatorHeartbeatProto . hasTaskStatus ( ) ) { this . onTaskStatusMessage ( new TaskStatusPOJO ( evaluatorHeartbeatProto . getTaskStatus ( ) , messageSequenceNumber ) ) ; } LOG . log ( Level . FINE , "DONE with evaluator heartbeat from Evaluator {0}" , this . getId ( ) ) ; } }
|
Process an evaluator heartbeat message .
|
2,031
|
private synchronized void onEvaluatorStatusMessage ( final EvaluatorStatusPOJO message ) { switch ( message . getState ( ) ) { case DONE : this . onEvaluatorDone ( message ) ; break ; case FAILED : this . onEvaluatorFailed ( message ) ; break ; case KILLED : this . onEvaluatorKilled ( message ) ; break ; case INIT : case RUNNING : case SUSPEND : break ; default : throw new RuntimeException ( "Unknown state: " + message . getState ( ) ) ; } }
|
Process a evaluator status message .
|
2,032
|
private synchronized void onEvaluatorDone ( final EvaluatorStatusPOJO message ) { assert message . getState ( ) == State . DONE ; LOG . log ( Level . FINEST , "Evaluator {0} done." , getId ( ) ) ; sendEvaluatorControlMessage ( EvaluatorRuntimeProtocol . EvaluatorControlProto . newBuilder ( ) . setTimestamp ( System . currentTimeMillis ( ) ) . setIdentifier ( getId ( ) ) . setDoneEvaluator ( EvaluatorRuntimeProtocol . DoneEvaluatorProto . newBuilder ( ) . build ( ) ) . build ( ) ) ; this . stateManager . setDone ( ) ; this . messageDispatcher . onEvaluatorCompleted ( new CompletedEvaluatorImpl ( this . evaluatorId ) ) ; this . close ( ) ; }
|
Process an evaluator message that indicates that the evaluator shut down cleanly .
|
2,033
|
private synchronized void onEvaluatorFailed ( final EvaluatorStatusPOJO evaluatorStatus ) { assert evaluatorStatus . getState ( ) == State . FAILED ; final EvaluatorException evaluatorException ; if ( evaluatorStatus . hasError ( ) ) { final Optional < Throwable > exception = this . exceptionCodec . fromBytes ( evaluatorStatus . getError ( ) ) ; evaluatorException = new EvaluatorException ( getId ( ) , exception . isPresent ( ) ? exception . get ( ) : new NonSerializableException ( "Exception sent, but can't be deserialized" , evaluatorStatus . getError ( ) ) ) ; } else { evaluatorException = new EvaluatorException ( getId ( ) , new Exception ( "No exception sent" ) ) ; } this . onEvaluatorException ( evaluatorException ) ; }
|
Process an evaluator message that indicates a crash .
|
2,034
|
private synchronized void onEvaluatorKilled ( final EvaluatorStatusPOJO message ) { assert message . getState ( ) == State . KILLED ; assert this . stateManager . isClosing ( ) ; LOG . log ( Level . WARNING , "Evaluator {0} killed completely." , getId ( ) ) ; this . stateManager . setKilled ( ) ; }
|
Process an evaluator message that indicates that the evaluator completed the unclean shut down request .
|
2,035
|
public void sendContextControlMessage ( final EvaluatorRuntimeProtocol . ContextControlProto contextControlProto ) { synchronized ( this . evaluatorDescriptor ) { LOG . log ( Level . FINEST , "Context control message to {0}" , this . evaluatorId ) ; this . contextControlHandler . send ( contextControlProto ) ; } }
|
Packages the ContextControlProto in an EvaluatorControlProto and forward it to the EvaluatorRuntime .
|
2,036
|
private void onTaskStatusMessage ( final TaskStatusPOJO taskStatus ) { if ( ! ( this . task . isPresent ( ) && this . task . get ( ) . getId ( ) . equals ( taskStatus . getTaskId ( ) ) ) ) { final State state = taskStatus . getState ( ) ; if ( state . isRestartable ( ) || this . driverRestartManager . getEvaluatorRestartState ( this . evaluatorId ) . isReregistered ( ) ) { if ( state . isRunning ( ) ) { LOG . log ( Level . WARNING , "Received a message of state {0} for Task {1} before receiving its {2} state" , new Object [ ] { State . RUNNING , taskStatus . getTaskId ( ) , State . INIT } ) ; } this . task = Optional . of ( new TaskRepresenter ( taskStatus . getTaskId ( ) , this . contextRepresenters . getContext ( taskStatus . getContextId ( ) ) , this . messageDispatcher , this , this . exceptionCodec , this . driverRestartManager ) ) ; } else { throw new RuntimeException ( "Received a message of state " + state + ", not INIT, RUNNING, or FAILED for Task " + taskStatus . getTaskId ( ) + " which we haven't heard from before." ) ; } } this . task . get ( ) . onTaskStatusMessage ( taskStatus ) ; if ( this . task . get ( ) . isNotRunning ( ) ) { LOG . log ( Level . FINEST , "Task no longer running. De-registering it." ) ; this . task = Optional . empty ( ) ; } }
|
Handle task status messages .
|
2,037
|
public boolean isReady ( final long time ) { while ( true ) { final long thisTs = this . current . get ( ) ; if ( thisTs >= time || this . current . compareAndSet ( thisTs , time ) ) { return true ; } } }
|
Check if the event with a given timestamp has occurred according to the timer . This implementation always returns true and updates current timer s time to the timestamp of the most distant future event .
|
2,038
|
public byte [ ] encode ( final T writable ) { try ( final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; final DataOutputStream dos = new DataOutputStream ( bos ) ) { writable . write ( dos ) ; return bos . toByteArray ( ) ; } catch ( final IOException ex ) { LOG . log ( Level . SEVERE , "Cannot encode object " + writable , ex ) ; throw new RemoteRuntimeException ( ex ) ; } }
|
Encodes Hadoop Writable object into a byte array .
|
2,039
|
public T decode ( final byte [ ] buffer ) { try ( final ByteArrayInputStream bis = new ByteArrayInputStream ( buffer ) ; final DataInputStream dis = new DataInputStream ( bis ) ) { final T writable = this . writableClass . newInstance ( ) ; writable . readFields ( dis ) ; return writable ; } catch ( final IOException | InstantiationException | IllegalAccessException ex ) { LOG . log ( Level . SEVERE , "Cannot decode class " + this . writableClass , ex ) ; throw new RemoteRuntimeException ( ex ) ; } }
|
Decode Hadoop Writable object from a byte array .
|
2,040
|
public void submitJob ( final String applicationId , final String storageContainerSAS , final URI jobJarUri , final String command ) throws IOException { final ResourceFile jarResourceFile = new ResourceFile ( ) . withBlobSource ( jobJarUri . toString ( ) ) . withFilePath ( AzureBatchFileNames . getTaskJarFileName ( ) ) ; final AuthenticationTokenSettings authenticationTokenSettings = new AuthenticationTokenSettings ( ) . withAccess ( Collections . singletonList ( AccessScope . JOB ) ) ; final EnvironmentSetting environmentSetting = new EnvironmentSetting ( ) . withName ( SharedAccessSignatureCloudBlobClientProvider . AZURE_STORAGE_CONTAINER_SAS_TOKEN_ENV ) . withValue ( storageContainerSAS ) ; final JobManagerTask jobManagerTask = new JobManagerTask ( ) . withRunExclusive ( false ) . withId ( applicationId ) . withResourceFiles ( Collections . singletonList ( jarResourceFile ) ) . withEnvironmentSettings ( Collections . singletonList ( environmentSetting ) ) . withAuthenticationTokenSettings ( authenticationTokenSettings ) . withKillJobOnCompletion ( true ) . withContainerSettings ( createTaskContainerSettings ( applicationId ) ) . withCommandLine ( command ) ; LOG . log ( Level . INFO , "Job Manager (aka driver) task command: {0}" , command ) ; final JobAddParameter jobAddParameter = new JobAddParameter ( ) . withId ( applicationId ) . withJobManagerTask ( jobManagerTask ) . withJobPreparationTask ( createJobPreparationTask ( ) ) . withPoolInfo ( poolInfo ) ; client . jobOperations ( ) . createJob ( jobAddParameter ) ; }
|
Create a job on Azure Batch .
|
2,041
|
public void submitTask ( final String jobId , final String taskId , final URI jobJarUri , final URI confUri , final String command ) throws IOException { final List < ResourceFile > resources = new ArrayList < > ( ) ; final ResourceFile jarSourceFile = new ResourceFile ( ) . withBlobSource ( jobJarUri . toString ( ) ) . withFilePath ( AzureBatchFileNames . getTaskJarFileName ( ) ) ; resources . add ( jarSourceFile ) ; final ResourceFile confSourceFile = new ResourceFile ( ) . withBlobSource ( confUri . toString ( ) ) . withFilePath ( this . azureBatchFileNames . getEvaluatorShimConfigurationPath ( ) ) ; resources . add ( confSourceFile ) ; LOG . log ( Level . INFO , "Evaluator task command: {0}" , command ) ; TaskAddParameter taskAddParameter = new TaskAddParameter ( ) . withId ( taskId ) . withResourceFiles ( resources ) . withContainerSettings ( createTaskContainerSettings ( taskId ) ) . withCommandLine ( command ) ; if ( this . areContainersEnabled ) { taskAddParameter = taskAddParameter . withUserIdentity ( new UserIdentity ( ) . withAutoUser ( new AutoUserSpecification ( ) . withElevationLevel ( ElevationLevel . ADMIN ) ) ) ; } this . client . taskOperations ( ) . createTask ( jobId , taskAddParameter ) ; }
|
Adds a single task to a job on Azure Batch .
|
2,042
|
public List < CloudTask > getTaskStatusForJob ( final String jobId ) { List < CloudTask > tasks = null ; try { tasks = client . taskOperations ( ) . listTasks ( jobId ) ; LOG . log ( Level . INFO , "Task status for job: {0} returned {1} tasks" , new Object [ ] { jobId , tasks . size ( ) } ) ; } catch ( IOException | BatchErrorException ex ) { LOG . log ( Level . SEVERE , "Exception when fetching Task status for job: {0}. Exception [{1}]:[2]" , new Object [ ] { jobId , ex . getMessage ( ) , ex . getStackTrace ( ) } ) ; } return tasks ; }
|
List the tasks of the specified job .
|
2,043
|
public byte [ ] encode ( final NamingLookupRequest obj ) { final List < CharSequence > ids = new ArrayList < > ( ) ; for ( final Identifier id : obj . getIdentifiers ( ) ) { ids . add ( id . toString ( ) ) ; } return AvroUtils . toBytes ( AvroNamingLookupRequest . newBuilder ( ) . setIds ( ids ) . build ( ) , AvroNamingLookupRequest . class ) ; }
|
Encodes the identifiers to bytes .
|
2,044
|
public NamingLookupRequest decode ( final byte [ ] buf ) { final AvroNamingLookupRequest req = AvroUtils . fromBytes ( buf , AvroNamingLookupRequest . class ) ; final List < Identifier > ids = new ArrayList < > ( req . getIds ( ) . size ( ) ) ; for ( final CharSequence s : req . getIds ( ) ) { ids . add ( factory . getNewInstance ( s . toString ( ) ) ) ; } return new NamingLookupRequest ( ids ) ; }
|
Decodes the bytes to a naming lookup request .
|
2,045
|
public static void main ( final String [ ] args ) throws BindException , InjectionException { final Configuration runtimeConf = getRuntimeConfiguration ( ) ; final Configuration driverConf = getDriverConfiguration ( ) ; final LauncherStatus status = DriverLauncher . getLauncher ( runtimeConf ) . run ( driverConf , JOB_TIMEOUT ) ; LOG . log ( Level . INFO , "REEF job completed: {0}" , status ) ; }
|
Start HelloJVMOptions REEF job .
|
2,046
|
private void setState ( final EvaluatorState toState ) { while ( true ) { final EvaluatorState fromState = this . state . get ( ) ; if ( fromState == toState ) { break ; } if ( ! fromState . isLegalTransition ( toState ) ) { LOG . log ( Level . WARNING , "Illegal state transition: {0} -> {1}" , new Object [ ] { fromState , toState } ) ; throw new IllegalStateException ( "Illegal state transition: " + fromState + " -> " + toState ) ; } if ( this . state . compareAndSet ( fromState , toState ) ) { break ; } } }
|
Transition to the new state of the evaluator if possible .
|
2,047
|
public static byte [ ] encode ( final TaskNode root ) { try ( final ByteArrayOutputStream bstream = new ByteArrayOutputStream ( ) ; final DataOutputStream dstream = new DataOutputStream ( bstream ) ) { encodeHelper ( dstream , root ) ; return bstream . toByteArray ( ) ; } catch ( final IOException e ) { throw new RuntimeException ( "Exception while encoding topology of " + root . getTaskId ( ) , e ) ; } }
|
Recursively encode TaskNodes of a Topology into a byte array .
|
2,048
|
public static Pair < TopologySimpleNode , List < Identifier > > decode ( final byte [ ] data , final IdentifierFactory ifac ) { try ( final DataInputStream dstream = new DataInputStream ( new ByteArrayInputStream ( data ) ) ) { final List < Identifier > activeSlaveTasks = new LinkedList < > ( ) ; final TopologySimpleNode retNode = decodeHelper ( dstream , activeSlaveTasks , ifac ) ; return new Pair < > ( retNode , activeSlaveTasks ) ; } catch ( final IOException e ) { throw new RuntimeException ( "Exception while decoding message" , e ) ; } }
|
Recursively translate a byte array into a TopologySimpleNode and a list of task Identifiers .
|
2,049
|
public synchronized void submitTask ( final ActiveContext context ) { final TaskEntity task = taskQueue . poll ( ) ; final Integer taskId = task . getId ( ) ; final String command = task . getCommand ( ) ; final Configuration taskConf = TaskConfiguration . CONF . set ( TaskConfiguration . TASK , ShellTask . class ) . set ( TaskConfiguration . IDENTIFIER , taskId . toString ( ) ) . build ( ) ; final Configuration commandConf = Tang . Factory . getTang ( ) . newConfigurationBuilder ( ) . bindNamedParameter ( Command . class , command ) . build ( ) ; final Configuration merged = Configurations . merge ( taskConf , commandConf ) ; context . submitTask ( merged ) ; runningTasks . add ( task ) ; }
|
Submit a task to the ActiveContext .
|
2,050
|
public synchronized int cancelTask ( final int taskId ) throws UnsuccessfulException , NotFoundException { if ( getTask ( taskId , runningTasks ) != null ) { throw new UnsuccessfulException ( "The task " + taskId + " is running" ) ; } else if ( getTask ( taskId , finishedTasks ) != null ) { throw new UnsuccessfulException ( "The task " + taskId + " has finished" ) ; } final TaskEntity task = getTask ( taskId , taskQueue ) ; if ( task == null ) { final String message = new StringBuilder ( ) . append ( "Task with ID " ) . append ( taskId ) . append ( " is not found" ) . toString ( ) ; throw new NotFoundException ( message ) ; } else { taskQueue . remove ( task ) ; canceledTasks . add ( task ) ; return taskId ; } }
|
Update the record of task to mark it as canceled .
|
2,051
|
public synchronized int clear ( ) { final int count = taskQueue . size ( ) ; for ( final TaskEntity task : taskQueue ) { canceledTasks . add ( task ) ; } taskQueue . clear ( ) ; return count ; }
|
Clear the pending list .
|
2,052
|
public synchronized Map < String , List < Integer > > getList ( ) { final Map < String , List < Integer > > tasks = new LinkedHashMap < > ( ) ; tasks . put ( "Running" , getTaskIdList ( runningTasks ) ) ; tasks . put ( "Waiting" , getTaskIdList ( taskQueue ) ) ; tasks . put ( "Finished" , getTaskIdList ( finishedTasks ) ) ; tasks . put ( "Canceled" , getTaskIdList ( canceledTasks ) ) ; return tasks ; }
|
Get the list of Tasks which are grouped by the states .
|
2,053
|
public synchronized String getTaskStatus ( final int taskId ) throws NotFoundException { final TaskEntity running = getTask ( taskId , runningTasks ) ; if ( running != null ) { return "Running : " + running . toString ( ) ; } final TaskEntity waiting = getTask ( taskId , taskQueue ) ; if ( waiting != null ) { return "Waiting : " + waiting . toString ( ) ; } final TaskEntity finished = getTask ( taskId , finishedTasks ) ; if ( finished != null ) { return "Finished : " + finished . toString ( ) ; } final TaskEntity canceled = getTask ( taskId , canceledTasks ) ; if ( canceled != null ) { return "Canceled: " + canceled . toString ( ) ; } throw new NotFoundException ( new StringBuilder ( ) . append ( "Task with ID " ) . append ( taskId ) . append ( " is not found" ) . toString ( ) ) ; }
|
Get the status of a Task .
|
2,054
|
public synchronized void setFinished ( final int taskId ) { final TaskEntity task = getTask ( taskId , runningTasks ) ; runningTasks . remove ( task ) ; finishedTasks . add ( task ) ; }
|
Update the record of task to mark it as finished .
|
2,055
|
private static TaskEntity getTask ( final int taskId , final Collection < TaskEntity > tasks ) { for ( final TaskEntity task : tasks ) { if ( taskId == task . getId ( ) ) { return task ; } } return null ; }
|
Iterate over the collection to find a TaskEntity with ID .
|
2,056
|
public static synchronized boolean assertSingleton ( final String scopeId , final Class clazz ) { ALL_CLASSES . add ( clazz ) ; return SINGLETONS_SCOPED . add ( new Tuple < > ( scopeId , clazz ) ) && ! SINGLETONS_GLOBAL . contains ( clazz ) ; }
|
Check if given class is singleton within a particular environment or scope .
|
2,057
|
private Configuration createDriverConfiguration ( final Configuration driverConfiguration ) { final ConfigurationBuilder configurationBuilder = Tang . Factory . getTang ( ) . newConfigurationBuilder ( driverConfiguration ) ; for ( final ConfigurationProvider configurationProvider : this . configurationProviders ) { configurationBuilder . addConfiguration ( configurationProvider . getConfiguration ( ) ) ; } return configurationBuilder . build ( ) ; }
|
Assembles the final Driver Configuration by merging in all the Configurations provided by ConfigurationProviders .
|
2,058
|
public AvroEvaluatorsInfo toAvro ( final List < String > ids , final Map < String , EvaluatorDescriptor > evaluators ) { final List < AvroEvaluatorInfo > evaluatorsInfo = new ArrayList < > ( ) ; for ( final String id : ids ) { final EvaluatorDescriptor evaluatorDescriptor = evaluators . get ( id ) ; String nodeId = null ; String nodeName = null ; InetSocketAddress address = null ; int memory = 0 ; String type = null ; String runtimeName = null ; if ( evaluatorDescriptor != null ) { nodeId = evaluatorDescriptor . getNodeDescriptor ( ) . getId ( ) ; nodeName = evaluatorDescriptor . getNodeDescriptor ( ) . getName ( ) ; address = evaluatorDescriptor . getNodeDescriptor ( ) . getInetSocketAddress ( ) ; memory = evaluatorDescriptor . getMemory ( ) ; type = evaluatorDescriptor . getProcess ( ) . getType ( ) . toString ( ) ; runtimeName = evaluatorDescriptor . getRuntimeName ( ) ; } evaluatorsInfo . add ( AvroEvaluatorInfo . newBuilder ( ) . setEvaluatorId ( id ) . setNodeId ( nodeId != null ? nodeId : "" ) . setNodeName ( nodeName != null ? nodeName : "" ) . setInternetAddress ( address != null ? address . toString ( ) : "" ) . setMemory ( memory ) . setType ( type != null ? type : "" ) . setRuntimeName ( runtimeName != null ? runtimeName : "" ) . build ( ) ) ; } return AvroEvaluatorsInfo . newBuilder ( ) . setEvaluatorsInfo ( evaluatorsInfo ) . build ( ) ; }
|
Create AvroEvaluatorsInfo object .
|
2,059
|
public synchronized V loadAndGet ( ) throws ExecutionException { try { value = Optional . ofNullable ( valueFetcher . call ( ) ) ; } catch ( final Exception e ) { throw new ExecutionException ( e ) ; } finally { writeTime = Optional . of ( currentTime . now ( ) ) ; this . notifyAll ( ) ; } if ( ! value . isPresent ( ) ) { throw new ExecutionException ( new NullPointerException ( "valueFetcher returned null" ) ) ; } else { return value . get ( ) ; } }
|
Must only be called once by the thread that created this WrappedValue .
|
2,060
|
private List < List < Double > > deepCopy ( final List < List < Double > > original ) { final List < List < Double > > result = new ArrayList < > ( original . size ( ) ) ; for ( final List < Double > originalRow : original ) { final List < Double > row = new ArrayList < > ( originalRow . size ( ) ) ; for ( final double element : originalRow ) { row . add ( element ) ; } result . add ( row ) ; } return result ; }
|
Create a deep copy to make the matrix immutable .
|
2,061
|
public void onNext ( final String alarmId ) { LOG . log ( Level . INFO , "Alarm {0} triggered" , alarmId ) ; final ClientAlarm clientAlarm = this . alarmMap . remove ( alarmId ) ; if ( clientAlarm != null ) { clientAlarm . run ( ) ; } else { LOG . log ( Level . SEVERE , "Unknown alarm id {0}" , alarmId ) ; } }
|
Alarm clock event handler .
|
2,062
|
public void deserialize ( final BinaryDecoder decoder , final MultiObserver observer , final long sequence ) throws IOException , IllegalAccessException , InvocationTargetException { final TMessage message = messageReader . read ( null , decoder ) ; if ( message != null ) { observer . onNext ( sequence , message ) ; } else { throw new RuntimeException ( "Failed to deserialize message [" + msgMetaClass . getSimpleName ( ) + "]" ) ; } }
|
Deserialize messages of type TMessage from input decoder .
|
2,063
|
synchronized void close ( ) { if ( this . remoteManager . isPresent ( ) ) { try { this . remoteManager . get ( ) . close ( ) ; } catch ( final Exception e ) { LOG . log ( Level . WARNING , "Exception while shutting down the RemoteManager." , e ) ; } } }
|
Closes the remote manager if there was one .
|
2,064
|
public synchronized void onNext ( final ClientRuntimeProtocol . JobControlProto jobControlProto ) { if ( jobControlProto . hasSignal ( ) ) { if ( jobControlProto . getSignal ( ) == ClientRuntimeProtocol . Signal . SIG_TERMINATE ) { try { if ( jobControlProto . hasMessage ( ) ) { getClientCloseWithMessageDispatcher ( ) . onNext ( jobControlProto . getMessage ( ) . toByteArray ( ) ) ; } else { getClientCloseDispatcher ( ) . onNext ( null ) ; } } finally { this . driverStatusManager . onComplete ( ) ; } } else { LOG . log ( Level . FINEST , "Unsupported signal: " + jobControlProto . getSignal ( ) ) ; } } else if ( jobControlProto . hasMessage ( ) ) { getClientMessageDispatcher ( ) . onNext ( jobControlProto . getMessage ( ) . toByteArray ( ) ) ; } }
|
This method reacts to control messages passed by the client to the driver . It will forward messages related to the ClientObserver interface to the Driver . It will also initiate a shutdown if the client indicates a close message .
|
2,065
|
public void onNext ( final T event ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "remoteid: {0}\n{1}" , new Object [ ] { remoteId . getSocketAddress ( ) , event . toString ( ) } ) ; } handler . onNext ( new RemoteEvent < T > ( myId . getSocketAddress ( ) , remoteId . getSocketAddress ( ) , seqGen . getNextSeq ( remoteId . getSocketAddress ( ) ) , event ) ) ; }
|
Sends the event to the event handler running remotely .
|
2,066
|
public byte [ ] encode ( final NamingRegisterRequest obj ) { final AvroNamingRegisterRequest result = AvroNamingRegisterRequest . newBuilder ( ) . setId ( obj . getNameAssignment ( ) . getIdentifier ( ) . toString ( ) ) . setHost ( obj . getNameAssignment ( ) . getAddress ( ) . getHostName ( ) ) . setPort ( obj . getNameAssignment ( ) . getAddress ( ) . getPort ( ) ) . build ( ) ; return AvroUtils . toBytes ( result , AvroNamingRegisterRequest . class ) ; }
|
Encodes the name assignment to bytes .
|
2,067
|
public NamingRegisterRequest decode ( final byte [ ] buf ) { final AvroNamingRegisterRequest avroNamingRegisterRequest = AvroUtils . fromBytes ( buf , AvroNamingRegisterRequest . class ) ; return new NamingRegisterRequest ( new NameAssignmentTuple ( factory . getNewInstance ( avroNamingRegisterRequest . getId ( ) . toString ( ) ) , new InetSocketAddress ( avroNamingRegisterRequest . getHost ( ) . toString ( ) , avroNamingRegisterRequest . getPort ( ) ) ) ) ; }
|
Decodes the bytes to a name assignment .
|
2,068
|
public void addHttpHandler ( final HttpHandler httpHandler ) { LOG . log ( Level . INFO , "addHttpHandler: {0}" , httpHandler . getUriSpecification ( ) ) ; jettyHandler . addHandler ( httpHandler ) ; }
|
Add a HttpHandler to Jetty Handler .
|
2,069
|
public byte [ ] encode ( final NetworkConnectionServiceMessage obj ) { final Codec codec = connFactoryMap . get ( obj . getConnectionFactoryId ( ) ) . getCodec ( ) ; Boolean isStreamingCodec = isStreamingCodecMap . get ( codec ) ; if ( isStreamingCodec == null ) { isStreamingCodec = codec instanceof StreamingCodec ; isStreamingCodecMap . putIfAbsent ( codec , isStreamingCodec ) ; } try ( final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { try ( final DataOutputStream daos = new DataOutputStream ( baos ) ) { daos . writeUTF ( obj . getConnectionFactoryId ( ) ) ; daos . writeUTF ( obj . getSrcId ( ) . toString ( ) ) ; daos . writeUTF ( obj . getDestId ( ) . toString ( ) ) ; daos . writeInt ( obj . getData ( ) . size ( ) ) ; if ( isStreamingCodec ) { for ( final Object rec : obj . getData ( ) ) { ( ( StreamingCodec ) codec ) . encodeToStream ( rec , daos ) ; } } else { final Iterable dataList = obj . getData ( ) ; for ( final Object message : dataList ) { final byte [ ] bytes = codec . encode ( message ) ; daos . writeInt ( bytes . length ) ; daos . write ( bytes ) ; } } return baos . toByteArray ( ) ; } } catch ( final IOException e ) { throw new RuntimeException ( "IOException" , e ) ; } }
|
Encodes a network connection service message to bytes .
|
2,070
|
public NetworkConnectionServiceMessage decode ( final byte [ ] data ) { try ( final ByteArrayInputStream bais = new ByteArrayInputStream ( data ) ) { try ( final DataInputStream dais = new DataInputStream ( bais ) ) { final String connFactoryId = dais . readUTF ( ) ; final Identifier srcId = factory . getNewInstance ( dais . readUTF ( ) ) ; final Identifier destId = factory . getNewInstance ( dais . readUTF ( ) ) ; final int size = dais . readInt ( ) ; final List list = new ArrayList ( size ) ; final Codec codec = connFactoryMap . get ( connFactoryId ) . getCodec ( ) ; Boolean isStreamingCodec = isStreamingCodecMap . get ( codec ) ; if ( isStreamingCodec == null ) { isStreamingCodec = codec instanceof StreamingCodec ; isStreamingCodecMap . putIfAbsent ( codec , isStreamingCodec ) ; } if ( isStreamingCodec ) { for ( int i = 0 ; i < size ; i ++ ) { list . add ( ( ( StreamingCodec ) codec ) . decodeFromStream ( dais ) ) ; } } else { for ( int i = 0 ; i < size ; i ++ ) { final int byteSize = dais . readInt ( ) ; final byte [ ] bytes = new byte [ byteSize ] ; if ( dais . read ( bytes ) == - 1 ) { LOG . log ( Level . FINE , "No data read because end of stream was reached" ) ; } list . add ( codec . decode ( bytes ) ) ; } } return new NetworkConnectionServiceMessage ( connFactoryId , srcId , destId , list ) ; } } catch ( final IOException e ) { throw new RuntimeException ( "IOException" , e ) ; } }
|
Decodes a network connection service message from bytes .
|
2,071
|
private Schema createAvroSchema ( final Configuration configuration , final MetadataFilter filter ) throws IOException { final ParquetMetadata footer = ParquetFileReader . readFooter ( configuration , parquetFilePath , filter ) ; final AvroSchemaConverter converter = new AvroSchemaConverter ( ) ; final MessageType schema = footer . getFileMetaData ( ) . getSchema ( ) ; return converter . convert ( schema ) ; }
|
Retrieve avro schema from parquet file .
|
2,072
|
public void serializeToDisk ( final File file ) throws IOException { final DatumWriter datumWriter = new GenericDatumWriter < GenericRecord > ( ) ; final DataFileWriter fileWriter = new DataFileWriter < GenericRecord > ( datumWriter ) ; final AvroParquetReader < GenericRecord > reader = createAvroReader ( ) ; fileWriter . create ( createAvroSchema ( ) , file ) ; GenericRecord record = reader . read ( ) ; while ( record != null ) { fileWriter . append ( record ) ; record = reader . read ( ) ; } try { reader . close ( ) ; } catch ( IOException ex ) { LOG . log ( Level . SEVERE , ex . getMessage ( ) ) ; throw ex ; } try { fileWriter . close ( ) ; } catch ( IOException ex ) { LOG . log ( Level . SEVERE , ex . getMessage ( ) ) ; throw ex ; } }
|
Serialize Avro data to a local file .
|
2,073
|
public ByteBuffer serializeToByteBuffer ( ) throws IOException { final ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; final Encoder encoder = EncoderFactory . get ( ) . binaryEncoder ( stream , null ) ; final DatumWriter writer = new GenericDatumWriter < GenericRecord > ( ) ; writer . setSchema ( createAvroSchema ( ) ) ; final AvroParquetReader < GenericRecord > reader = createAvroReader ( ) ; GenericRecord record = reader . read ( ) ; while ( record != null ) { writer . write ( record , encoder ) ; record = reader . read ( ) ; } try { reader . close ( ) ; } catch ( IOException ex ) { LOG . log ( Level . SEVERE , ex . getMessage ( ) ) ; throw ex ; } encoder . flush ( ) ; final ByteBuffer buf = ByteBuffer . wrap ( stream . toByteArray ( ) ) ; buf . order ( ByteOrder . LITTLE_ENDIAN ) ; return buf ; }
|
Serialize Avro data to a in - memory ByteBuffer .
|
2,074
|
public static String getTaskId ( final Configuration config ) { try { return Tang . Factory . getTang ( ) . newInjector ( config ) . getNamedInstance ( TaskConfigurationOptions . Identifier . class ) ; } catch ( final InjectionException ex ) { throw new RuntimeException ( "Unable to determine task identifier. Giving up." , ex ) ; } }
|
Extracts a task id from the given configuration .
|
2,075
|
public static DriverLauncher getLauncher ( final Configuration runtimeConfiguration ) throws InjectionException { return Tang . Factory . getTang ( ) . newInjector ( runtimeConfiguration , CLIENT_CONFIG ) . getInstance ( DriverLauncher . class ) ; }
|
Instantiate a launcher for the given Configuration .
|
2,076
|
public void close ( ) { synchronized ( this ) { LOG . log ( Level . FINER , "Close launcher: job {0} with status {1}" , new Object [ ] { this . theJob , this . status } ) ; if ( this . status . isRunning ( ) ) { this . status = LauncherStatus . FORCE_CLOSED ; } if ( null != this . theJob ) { this . theJob . close ( ) ; } this . notify ( ) ; } LOG . log ( Level . FINEST , "Close launcher: shutdown REEF" ) ; this . reef . close ( ) ; LOG . log ( Level . FINEST , "Close launcher: done" ) ; }
|
Kills the running job .
|
2,077
|
public LauncherStatus run ( final Configuration driverConfig ) { this . reef . submit ( driverConfig ) ; synchronized ( this ) { while ( ! this . status . isDone ( ) ) { try { LOG . log ( Level . FINE , "Wait indefinitely" ) ; this . wait ( ) ; } catch ( final InterruptedException ex ) { LOG . log ( Level . FINE , "Interrupted: {0}" , ex ) ; } } } this . reef . close ( ) ; return this . getStatus ( ) ; }
|
Run a job . Waits indefinitely for the job to complete .
|
2,078
|
public String submit ( final Configuration driverConfig , final long waitTime ) { this . reef . submit ( driverConfig ) ; this . waitForStatus ( waitTime , LauncherStatus . SUBMITTED ) ; return this . jobId ; }
|
Submit REEF job asynchronously and do not wait for its completion .
|
2,079
|
public LauncherStatus run ( final Configuration driverConfig , final long timeOut ) { final long startTime = System . currentTimeMillis ( ) ; this . reef . submit ( driverConfig ) ; this . waitForStatus ( timeOut - System . currentTimeMillis ( ) + startTime , LauncherStatus . COMPLETED ) ; if ( System . currentTimeMillis ( ) - startTime >= timeOut ) { LOG . log ( Level . WARNING , "The Job timed out." ) ; synchronized ( this ) { this . status = LauncherStatus . FORCE_CLOSED ; } } this . reef . close ( ) ; return this . getStatus ( ) ; }
|
Run a job with a waiting timeout after which it will be killed if it did not complete yet .
|
2,080
|
public synchronized void setStatusAndNotify ( final LauncherStatus newStatus ) { LOG . log ( Level . FINEST , "Set status: {0} -> {1}" , new Object [ ] { this . status , newStatus } ) ; this . status = newStatus ; this . notify ( ) ; }
|
Update job status and notify the waiting thread .
|
2,081
|
private void logAll ( ) { synchronized ( this ) { final StringBuilder sb = new StringBuilder ( ) ; Level highestLevel = Level . FINEST ; for ( final LogRecord record : this . logs ) { sb . append ( formatter . format ( record ) ) ; sb . append ( "\n" ) ; if ( record . getLevel ( ) . intValue ( ) > highestLevel . intValue ( ) ) { highestLevel = record . getLevel ( ) ; } } try { final int level = getLevel ( highestLevel ) ; NativeInterop . clrBufferedLog ( level , sb . toString ( ) ) ; } catch ( Exception e ) { System . err . println ( "Failed to perform CLRBufferedLogHandler" ) ; } this . logs . clear ( ) ; } }
|
Flushes the log buffer logging each buffered log message using the reef - bridge log function .
|
2,082
|
private int getLevel ( final Level recordLevel ) { if ( recordLevel . equals ( Level . OFF ) ) { return 0 ; } else if ( recordLevel . equals ( Level . SEVERE ) ) { return 1 ; } else if ( recordLevel . equals ( Level . WARNING ) ) { return 2 ; } else if ( recordLevel . equals ( Level . ALL ) ) { return 4 ; } else { return 3 ; } }
|
Returns the integer value of the log record s level to be used by the CLR Bridge log function .
|
2,083
|
public List < HeaderEntry > getHeaderEntryList ( ) { final List < HeaderEntry > list = new ArrayList < > ( ) ; final Iterator it = this . headers . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { final Map . Entry pair = ( Map . Entry ) it . next ( ) ; System . out . println ( pair . getKey ( ) + " = " + pair . getValue ( ) ) ; final HeaderEntry e = HeaderEntry . newBuilder ( ) . setKey ( ( String ) pair . getKey ( ) ) . setValue ( ( String ) pair . getValue ( ) ) . build ( ) ; list . add ( e ) ; it . remove ( ) ; } return list ; }
|
get http header as a list of HeaderEntry .
|
2,084
|
public void close ( final byte [ ] message ) { LOG . log ( Level . FINEST , "Triggering Task close." ) ; synchronized ( this . heartBeatManager ) { if ( this . currentStatus . isNotRunning ( ) ) { LOG . log ( Level . WARNING , "Trying to close a task that is in state: {0}. Ignoring." , this . currentStatus . getState ( ) ) ; } else { try { this . closeTask ( message ) ; this . currentStatus . setCloseRequested ( ) ; } catch ( final TaskCloseHandlerFailure taskCloseHandlerFailure ) { LOG . log ( Level . WARNING , "Exception while executing task close handler." , taskCloseHandlerFailure . getCause ( ) ) ; this . currentStatus . setException ( taskCloseHandlerFailure . getCause ( ) ) ; } } } }
|
Close the Task . This calls the configured close handler .
|
2,085
|
public void suspend ( final byte [ ] message ) { synchronized ( this . heartBeatManager ) { if ( this . currentStatus . isNotRunning ( ) ) { LOG . log ( Level . WARNING , "Trying to suspend a task that is in state: {0}. Ignoring." , this . currentStatus . getState ( ) ) ; } else { try { this . suspendTask ( message ) ; this . currentStatus . setSuspendRequested ( ) ; } catch ( final TaskSuspendHandlerFailure taskSuspendHandlerFailure ) { LOG . log ( Level . WARNING , "Exception while executing task suspend handler." , taskSuspendHandlerFailure . getCause ( ) ) ; this . currentStatus . setException ( taskSuspendHandlerFailure . getCause ( ) ) ; } } } }
|
Suspend the Task . This calls the configured suspend handler .
|
2,086
|
public void deliver ( final byte [ ] message ) { synchronized ( this . heartBeatManager ) { if ( this . currentStatus . isNotRunning ( ) ) { LOG . log ( Level . WARNING , "Trying to send a message to a task that is in state: {0}. Ignoring." , this . currentStatus . getState ( ) ) ; } else { try { this . deliverMessageToTask ( message ) ; } catch ( final TaskMessageHandlerFailure taskMessageHandlerFailure ) { LOG . log ( Level . WARNING , "Exception while executing task close handler." , taskMessageHandlerFailure . getCause ( ) ) ; this . currentStatus . setException ( taskMessageHandlerFailure . getCause ( ) ) ; } } } }
|
Deliver a message to the Task . This calls into the user supplied message handler .
|
2,087
|
@ SuppressWarnings ( "checkstyle:illegalcatch" ) private void closeTask ( final byte [ ] message ) throws TaskCloseHandlerFailure { LOG . log ( Level . FINEST , "Invoking close handler." ) ; try { this . fCloseHandler . get ( ) . onNext ( new CloseEventImpl ( message ) ) ; } catch ( final Throwable throwable ) { throw new TaskCloseHandlerFailure ( throwable ) ; } }
|
Calls the configured Task close handler and catches exceptions it may throw .
|
2,088
|
@ SuppressWarnings ( "checkstyle:illegalcatch" ) private void deliverMessageToTask ( final byte [ ] message ) throws TaskMessageHandlerFailure { try { this . fMessageHandler . get ( ) . onNext ( new DriverMessageImpl ( message ) ) ; } catch ( final Throwable throwable ) { throw new TaskMessageHandlerFailure ( throwable ) ; } }
|
Calls the configured Task message handler and catches exceptions it may throw .
|
2,089
|
@ SuppressWarnings ( "checkstyle:illegalcatch" ) private void suspendTask ( final byte [ ] message ) throws TaskSuspendHandlerFailure { try { this . fSuspendHandler . get ( ) . onNext ( new SuspendEventImpl ( message ) ) ; } catch ( final Throwable throwable ) { throw new TaskSuspendHandlerFailure ( throwable ) ; } }
|
Calls the configured Task suspend handler and catches exceptions it may throw .
|
2,090
|
public void onNext ( final TransportEvent e ) { final RemoteEvent < byte [ ] > re = codec . decode ( e . getData ( ) ) ; re . setLocalAddress ( e . getLocalAddress ( ) ) ; re . setRemoteAddress ( e . getRemoteAddress ( ) ) ; if ( LOG . isLoggable ( Level . FINER ) ) { LOG . log ( Level . FINER , "{0} {1}" , new Object [ ] { e , re } ) ; } handler . onNext ( re ) ; }
|
Handles the event received from a remote node .
|
2,091
|
public final < T > ConfigurationModule setMultiple ( final Param < T > opt , final Iterable < String > values ) { ConfigurationModule c = deepCopy ( ) ; for ( final String val : values ) { c = c . set ( opt , val ) ; } return c ; }
|
Binds a set of values to a Param using ConfigurationModule .
|
2,092
|
private static List < String > toConfigurationStringList ( final Configuration c ) { final ConfigurationImpl conf = ( ConfigurationImpl ) c ; final List < String > l = new ArrayList < > ( ) ; for ( final ClassNode < ? > opt : conf . getBoundImplementations ( ) ) { l . add ( opt . getFullName ( ) + '=' + escape ( conf . getBoundImplementation ( opt ) . getFullName ( ) ) ) ; } for ( final ClassNode < ? > opt : conf . getBoundConstructors ( ) ) { l . add ( opt . getFullName ( ) + '=' + escape ( conf . getBoundConstructor ( opt ) . getFullName ( ) ) ) ; } for ( final NamedParameterNode < ? > opt : conf . getNamedParameters ( ) ) { l . add ( opt . getFullName ( ) + '=' + escape ( conf . getNamedParameter ( opt ) ) ) ; } for ( final ClassNode < ? > cn : conf . getLegacyConstructors ( ) ) { final StringBuilder sb = new StringBuilder ( ) ; join ( sb , "-" , conf . getLegacyConstructor ( cn ) . getArgs ( ) ) ; l . add ( cn . getFullName ( ) + escape ( '=' + ConfigurationBuilderImpl . INIT + '(' + sb . toString ( ) + ')' ) ) ; } for ( final NamedParameterNode < Set < ? > > key : conf . getBoundSets ( ) ) { for ( final Object value : conf . getBoundSet ( key ) ) { final String val ; if ( value instanceof String ) { val = ( String ) value ; } else if ( value instanceof Node ) { val = ( ( Node ) value ) . getFullName ( ) ; } else { throw new IllegalStateException ( "The value bound to a given NamedParameterNode " + key + " is neither the set of class hierarchy nodes nor strings." ) ; } l . add ( key . getFullName ( ) + '=' + escape ( val ) ) ; } } return l ; }
|
Convert Configuration to a list of strings formatted as param = value .
|
2,093
|
@ SuppressWarnings ( "checkstyle:illegalcatch" ) public void onNext ( final T value ) { beforeOnNext ( ) ; try { handler . onNext ( value ) ; } catch ( final Throwable t ) { if ( errorHandler != null ) { errorHandler . onNext ( t ) ; } else { LOG . log ( Level . SEVERE , name + " Exception from event handler" , t ) ; throw t ; } } afterOnNext ( ) ; }
|
Invokes the handler for the event .
|
2,094
|
public synchronized void send ( final ReefServiceProtos . JobStatusProto status ) { LOG . log ( Level . FINEST , "Sending to client: status={0}" , status . getState ( ) ) ; this . jobStatusHandler . onNext ( status ) ; }
|
Send the given JobStatus to the client .
|
2,095
|
@ SuppressWarnings ( "checkstyle:illegalcatch" ) public static REEFEnvironment fromConfiguration ( final UserCredentials hostUser , final Configuration ... configurations ) throws InjectionException { final Configuration config = Configurations . merge ( configurations ) ; if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "Configuration:\n--\n{0}\n--" , Configurations . toString ( config , true ) ) ; } final Injector injector = TANG . newInjector ( config ) ; if ( ProfilerState . isProfilingEnabled ( injector ) ) { final WakeProfiler profiler = new WakeProfiler ( ) ; ProfilingStopHandler . setProfiler ( profiler ) ; injector . bindAspect ( profiler ) ; } injector . getInstance ( REEFVersion . class ) . logVersion ( ) ; final REEFErrorHandler errorHandler = injector . getInstance ( REEFErrorHandler . class ) ; final JobStatusHandler jobStatusHandler = injector . getInstance ( JobStatusHandler . class ) ; if ( hostUser != null ) { try { injector . getInstance ( UserCredentials . class ) . set ( "reef-proxy" , hostUser ) ; } catch ( final IOException ex ) { final String msg = "Cannot copy user credentials: " + hostUser ; LOG . log ( Level . SEVERE , msg , ex ) ; throw new RuntimeException ( msg , ex ) ; } } try { final Clock clock = injector . getInstance ( Clock . class ) ; return new REEFEnvironment ( clock , errorHandler , jobStatusHandler ) ; } catch ( final Throwable ex ) { LOG . log ( Level . SEVERE , "Error while instantiating the clock" , ex ) ; try { errorHandler . onNext ( ex ) ; } catch ( final Throwable exHandling ) { LOG . log ( Level . SEVERE , "Error while handling the exception " + ex , exHandling ) ; } throw ex ; } }
|
Create a new REEF environment .
|
2,096
|
public void write ( final T message ) { this . link . write ( new NSMessage < T > ( this . srcId , this . destId , message ) ) ; }
|
Writes a message to the connection .
|
2,097
|
public Configuration getMainConfiguration ( ) { return Tang . Factory . getTang ( ) . newConfigurationBuilder ( ) . bindImplementation ( RuntimeClasspathProvider . class , YarnClasspathProvider . class ) . bindConstructor ( org . apache . hadoop . yarn . conf . YarnConfiguration . class , YarnConfigurationConstructor . class ) . build ( ) ; }
|
Generates configuration that allows multi runtime to run on Yarn . MultiRuntimeMainConfigurationGenerator .
|
2,098
|
public boolean block ( final long identifier , final Runnable asyncProcessor ) throws InterruptedException , InvalidIdentifierException { final ComplexCondition call = allocate ( ) ; if ( call . isHeldByCurrentThread ( ) ) { throw new RuntimeException ( "release() must not be called on same thread as block() to prevent deadlock" ) ; } try { call . lock ( ) ; addSleeper ( identifier , call ) ; if ( executor == null ) { asyncProcessor . run ( ) ; } else { executor . execute ( asyncProcessor ) ; } LOG . log ( Level . FINER , "Putting caller to sleep on identifier [{0}]" , identifier ) ; final boolean timeoutOccurred = ! call . await ( ) ; if ( timeoutOccurred ) { LOG . log ( Level . WARNING , "Call timed out on identifier [{0}]" , identifier ) ; } return timeoutOccurred ; } finally { try { removeSleeper ( identifier ) ; recycle ( call ) ; } finally { call . unlock ( ) ; } } }
|
Put the caller to sleep on a specific release identifier .
|
2,099
|
public void release ( final long identifier ) throws InterruptedException , InvalidIdentifierException { final ComplexCondition call = getSleeper ( identifier ) ; if ( call . isHeldByCurrentThread ( ) ) { throw new RuntimeException ( "release() must not be called on same thread as block() to prevent deadlock" ) ; } try { call . lock ( ) ; LOG . log ( Level . FINER , "Waking caller sleeping on identifier [{0}]" , identifier ) ; call . signal ( ) ; } finally { call . unlock ( ) ; } }
|
Wake the caller sleeping on the specific identifier .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.