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 DriverRestarted... | 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 DriverFatal... | 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 ) ; t... | 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 .... | 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 ... | 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 AvroNamedParamet... | 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... | 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 ... | 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 , ... | 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 , jobSubmiss... | 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 , jobSu... | 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_... | 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 Avro... | 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 . addOpt... | 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 ( ) . processCommandLin... | 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 ++ ) { ... | 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 ... | 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 Run... | 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 ( ) , th... | 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 .... | 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 . FIN... | 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 : ca... | 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 . c... | 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 ( evaluat... | 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 . getEvaluatorResta... | 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 obj... | 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 |... | 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 ( ) ... | 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 ( ) ) ... | 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 | Ba... | 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 ( ) , AvroNamin... | 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 . get... | 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_... | 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 [ ] { fromSta... | 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 Runti... | 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 TopologySimpleNo... | 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 ) . s... | 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 UnsuccessfulExcept... | 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 ... | 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 "W... | 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 ) { con... | 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 = nul... | 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 ( ) ... | 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... | 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 ) ; } ... | 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 ( ) ... | 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 ( ) , s... | 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 . getNa... | 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 ( ) . toS... | 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 ; is... | 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 ( ... | 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 sche... | 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 ( ) ; fileWrite... | 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 ( create... | 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... | 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 ( ) ;... | 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 , "Int... | 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 . currentTimeMill... | 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 . intVal... | 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 { retu... | 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 ( ) + " = " + pai... | 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 (... | 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 ) ;... | 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 . deliverMessageT... | 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 ... | 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 ... | 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 .... | 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 ) ; t... | 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 ) ) { L... | 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 .... | 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... | 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... | 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.