idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
43,200 | 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 . | 92 | 9 |
43,201 | 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 . | 147 | 14 |
43,202 | 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 . | 103 | 16 |
43,203 | 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 TopologySimpleNod... | Recursively translate a byte array into a TopologySimpleNode and a list of task Identifiers . | 143 | 21 |
43,204 | 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 . | 166 | 8 |
43,205 | 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 . | 191 | 11 |
43,206 | 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 . | 50 | 5 |
43,207 | 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 . | 121 | 13 |
43,208 | 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 . | 211 | 7 |
43,209 | 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 . | 48 | 11 |
43,210 | 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 . | 53 | 13 |
43,211 | 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 . | 75 | 14 |
43,212 | 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 . | 75 | 20 |
43,213 | @ Override 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 no... | Create AvroEvaluatorsInfo object . | 420 | 10 |
43,214 | 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 . | 119 | 15 |
43,215 | 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 e... | Create a deep copy to make the matrix immutable . | 109 | 10 |
43,216 | @ Override 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 . | 98 | 6 |
43,217 | 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 . | 103 | 13 |
43,218 | 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 . | 68 | 10 |
43,219 | @ Override public synchronized void onNext ( final ClientRuntimeProtocol . JobControlProto jobControlProto ) { if ( jobControlProto . hasSignal ( ) ) { if ( jobControlProto . getSignal ( ) == ClientRuntimeProtocol . Signal . SIG_TERMINATE ) { try { if ( jobControlProto . hasMessage ( ) ) { getClientCloseWithMessageDisp... | 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 . | 224 | 43 |
43,220 | @ Override 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 . getSocketAddr... | Sends the event to the event handler running remotely . | 127 | 11 |
43,221 | @ Override public byte [ ] encode ( final NamingRegisterRequest obj ) { final AvroNamingRegisterRequest result = AvroNamingRegisterRequest . newBuilder ( ) . setId ( obj . getNameAssignment ( ) . getIdentifier ( ) . toString ( ) ) . setHost ( obj . getNameAssignment ( ) . getAddress ( ) . getHostName ( ) ) . setPort ( ... | Encodes the name assignment to bytes . | 135 | 8 |
43,222 | @ Override public NamingRegisterRequest decode ( final byte [ ] buf ) { final AvroNamingRegisterRequest avroNamingRegisterRequest = AvroUtils . fromBytes ( buf , AvroNamingRegisterRequest . class ) ; return new NamingRegisterRequest ( new NameAssignmentTuple ( factory . getNewInstance ( avroNamingRegisterRequest . getI... | Decodes the bytes to a name assignment . | 128 | 9 |
43,223 | @ Override public void addHttpHandler ( final HttpHandler httpHandler ) { LOG . log ( Level . INFO , "addHttpHandler: {0}" , httpHandler . getUriSpecification ( ) ) ; jettyHandler . addHandler ( httpHandler ) ; } | Add a HttpHandler to Jetty Handler . | 58 | 10 |
43,224 | @ Override 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 Streamin... | Encodes a network connection service message to bytes . | 359 | 10 |
43,225 | @ Override 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 . getNew... | Decodes a network connection service message from bytes . | 408 | 10 |
43,226 | 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 . | 101 | 10 |
43,227 | 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 . | 203 | 10 |
43,228 | 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 . | 223 | 13 |
43,229 | 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 . | 79 | 11 |
43,230 | 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 . | 54 | 9 |
43,231 | @ Override 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 . ... | Kills the running job . | 151 | 6 |
43,232 | 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 . | 112 | 13 |
43,233 | 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 . | 50 | 15 |
43,234 | 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 . | 139 | 20 |
43,235 | 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 . | 65 | 9 |
43,236 | 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 . | 176 | 19 |
43,237 | 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 . | 91 | 20 |
43,238 | 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... | get http header as a list of HeaderEntry . | 170 | 10 |
43,239 | 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 . | 179 | 11 |
43,240 | 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 . | 172 | 13 |
43,241 | 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 . | 155 | 17 |
43,242 | @ 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 . | 96 | 14 |
43,243 | @ 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 . | 81 | 14 |
43,244 | @ 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 . | 86 | 14 |
43,245 | @ Override 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}" , ... | Handles the event received from a remote node . | 119 | 10 |
43,246 | 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 . | 60 | 13 |
43,247 | 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 . | 457 | 14 |
43,248 | @ Override @ 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... | Invokes the handler for the event . | 107 | 8 |
43,249 | 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 . | 59 | 9 |
43,250 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) // Catch throwable to feed it to error handler public static REEFEnvironment fromConfiguration ( final UserCredentials hostUser , final Configuration ... configurations ) throws InjectionException { final Configuration config = Configurations . merge ( configurations ) ;... | Create a new REEF environment . | 455 | 7 |
43,251 | @ Override public void write ( final T message ) { this . link . write ( new NSMessage < T > ( this . srcId , this . destId , message ) ) ; } | Writes a message to the connection . | 40 | 8 |
43,252 | @ Override public Configuration getMainConfiguration ( ) { return Tang . Factory . getTang ( ) . newConfigurationBuilder ( ) . bindImplementation ( RuntimeClasspathProvider . class , YarnClasspathProvider . class ) . bindConstructor ( org . apache . hadoop . yarn . conf . YarnConfiguration . class , YarnConfigurationCo... | Generates configuration that allows multi runtime to run on Yarn . MultiRuntimeMainConfigurationGenerator . | 83 | 20 |
43,253 | 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 . | 336 | 11 |
43,254 | 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 . | 121 | 10 |
43,255 | private ComplexCondition allocate ( ) { final ComplexCondition call = freeQueue . poll ( ) ; return call != null ? call : new ComplexCondition ( timeoutPeriod , timeoutUnits ) ; } | Allocate a condition variable . May reuse existing ones . | 40 | 11 |
43,256 | private void addSleeper ( final long identifier , final ComplexCondition call ) { if ( sleeperMap . put ( identifier , call ) != null ) { throw new RuntimeException ( String . format ( "Duplicate identifier [%d] in sleeper map" , identifier ) ) ; } } | Atomically add a coll to the sleeper map . | 61 | 11 |
43,257 | private ComplexCondition getSleeper ( final long identifier ) throws InvalidIdentifierException { final ComplexCondition call = sleeperMap . get ( identifier ) ; if ( null == call ) { throw new InvalidIdentifierException ( identifier ) ; } return call ; } | Get a reference to a sleeper with a specific identifier without removing it from the sleeper map . | 53 | 18 |
43,258 | private void removeSleeper ( final long identifier ) throws InvalidIdentifierException { final ComplexCondition call = sleeperMap . remove ( identifier ) ; if ( null == call ) { throw new InvalidIdentifierException ( identifier ) ; } } | Remove the specified call from the sleeper map . | 49 | 9 |
43,259 | @ SuppressWarnings ( "unchecked" ) private < T > T parseBoundNamedParameter ( final NamedParameterNode < T > np ) { final T ret ; @ SuppressWarnings ( "rawtypes" ) final Set < Object > boundSet = c . getBoundSet ( ( NamedParameterNode ) np ) ; if ( ! boundSet . isEmpty ( ) ) { final Set < T > ret2 = new MonotonicSet <>... | Parse the bound value of np . When possible this returns a cached instance . | 636 | 16 |
43,260 | public void subscribe ( final Class < ? extends T > clazz , final EventHandler < ? extends T > handler ) { lock . writeLock ( ) . lock ( ) ; try { List < EventHandler < ? extends T > > list = clazzToListOfHandlersMap . get ( clazz ) ; if ( list == null ) { list = new LinkedList < EventHandler < ? extends T > > ( ) ; cl... | Subscribes an event handler for an event class type . | 131 | 12 |
43,261 | @ Override public void onNext ( final T event ) { LOG . log ( Level . FINEST , "Invoked for event: {0}" , event ) ; lock . readLock ( ) . lock ( ) ; final List < EventHandler < ? extends T > > list ; try { list = clazzToListOfHandlersMap . get ( event . getClass ( ) ) ; if ( list == null ) { throw new WakeRuntimeExcept... | Invokes subscribed handlers for the event class type . | 181 | 10 |
43,262 | public static GroupCommunicationMessage getGCM ( final Message < GroupCommunicationMessage > msg ) { final Iterator < GroupCommunicationMessage > gcmIterator = msg . getData ( ) . iterator ( ) ; if ( gcmIterator . hasNext ( ) ) { final GroupCommunicationMessage gcm = gcmIterator . next ( ) ; if ( gcmIterator . hasNext ... | Extract a group communication message object from a message . | 137 | 11 |
43,263 | public static void main ( final String [ ] args ) throws InjectionException { LOG . log ( Level . FINE , "Launching Unmanaged AM: {0}" , JAR_PATH ) ; try ( final DriverLauncher client = DriverLauncher . getLauncher ( RUNTIME_CONFIG ) ) { final String appId = client . submit ( DRIVER_CONFIG , 10000 ) ; LOG . log ( Level... | Start Hello REEF job with Unmanaged Driver running locally in the same process . | 331 | 16 |
43,264 | @ Override public void onNext ( final T value ) { beforeOnNext ( ) ; executor . submit ( new Runnable ( ) { @ Override public void run ( ) { observer . onNext ( value ) ; afterOnNext ( ) ; } } ) ; } | Provides the observer with the new value . | 59 | 9 |
43,265 | @ Override public void onError ( final Exception error ) { submitCompletion ( new Runnable ( ) { @ Override public void run ( ) { observer . onError ( error ) ; } } ) ; } | Notifies the observer that the provider has experienced an error condition . | 46 | 13 |
43,266 | @ Override @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void onNext ( final T value ) { beforeOnNext ( ) ; try { executor . submit ( new Runnable ( ) { @ Override public void run ( ) { try { handler . onNext ( value ) ; } catch ( final Throwable t ) { if ( errorHandler != null ) { errorHandler . onNext ( t )... | Handles the event using a thread in the thread pool . | 182 | 12 |
43,267 | public static DriverFiles fromJobSubmission ( final JobSubmissionEvent jobSubmissionEvent , final REEFFileNames fileNames ) throws IOException { final DriverFiles driverFiles = new DriverFiles ( fileNames ) ; for ( final FileResource frp : jobSubmissionEvent . getGlobalFileSet ( ) ) { final File f = new File ( frp . ge... | Instantiates an instance based on the given JobSubmissionProto . | 206 | 15 |
43,268 | public ConfigurationModule addNamesTo ( final ConfigurationModule input , final OptionalParameter < String > globalFileField , final OptionalParameter < String > globalLibField , final OptionalParameter < String > localFileField , final OptionalParameter < String > localLibField ) { ConfigurationModule result = input ;... | Fills out a ConfigurationModule . | 137 | 7 |
43,269 | private File downloadToTempFolder ( final String applicationId ) throws URISyntaxException , StorageException , IOException { final File outputFolder = Files . createTempDirectory ( "reeflogs-" + applicationId ) . toFile ( ) ; if ( ! outputFolder . exists ( ) && ! outputFolder . mkdirs ( ) ) { LOG . log ( Level . WARNI... | Downloads the logs to a local temp folder . | 260 | 10 |
43,270 | @ Override public void unregister ( final Identifier id ) { LOG . log ( Level . FINE , "id: " + id ) ; idToAddrMap . remove ( id ) ; } | Unregisters an identifier locally . | 43 | 7 |
43,271 | @ Override public InetSocketAddress lookup ( final Identifier id ) { LOG . log ( Level . FINE , "id: {0}" , id ) ; return idToAddrMap . get ( id ) ; } | Finds an address for an identifier locally . | 48 | 9 |
43,272 | @ Override public List < NameAssignment > lookup ( final Iterable < Identifier > identifiers ) { LOG . log ( Level . FINE , "identifiers" ) ; final List < NameAssignment > nas = new ArrayList <> ( ) ; for ( final Identifier id : identifiers ) { final InetSocketAddress addr = idToAddrMap . get ( id ) ; LOG . log ( Level... | Finds addresses for identifiers locally . | 144 | 7 |
43,273 | private String getQueue ( final Configuration driverConfiguration ) { try { return Tang . Factory . getTang ( ) . newInjector ( driverConfiguration ) . getNamedInstance ( JobQueue . class ) ; } catch ( final InjectionException e ) { return this . defaultQueueName ; } } | Extracts the queue name from the driverConfiguration or return default if none is set . | 62 | 18 |
43,274 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) void startTask ( final Configuration taskConfig ) throws TaskClientCodeException { synchronized ( this . contextLifeCycle ) { if ( this . task . isPresent ( ) && this . task . get ( ) . hasEnded ( ) ) { // clean up state this . task = Optional . empty ( ) ; } if ( this .... | Launches a Task on this context . | 408 | 8 |
43,275 | void close ( ) { synchronized ( this . contextLifeCycle ) { this . contextState = ReefServiceProtos . ContextStatusProto . State . DONE ; if ( this . task . isPresent ( ) ) { LOG . log ( Level . WARNING , "Shutting down a task because the underlying context is being closed." ) ; this . task . get ( ) . close ( null ) ;... | Close this context . If there is a child context this recursively closes it before closing this context . If there is a Task currently running that will be closed . | 177 | 33 |
43,276 | public static LauncherStatus runHelloReef ( final Configuration runtimeConf , final int timeOut ) throws BindException , InjectionException { final Configuration driverConf = Configurations . merge ( HelloREEFHttp . getDriverConfiguration ( ) , getHTTPConfiguration ( ) ) ; return DriverLauncher . getLauncher ( runtimeC... | Run Hello Reef with merged configuration . | 78 | 7 |
43,277 | @ Override public void channelActive ( final ChannelHandlerContext ctx ) throws Exception { this . channelGroup . add ( ctx . channel ( ) ) ; this . listener . channelActive ( ctx ) ; super . channelActive ( ctx ) ; } | Handles the channel active event . | 54 | 7 |
43,278 | @ Override public void channelInactive ( final ChannelHandlerContext ctx ) throws Exception { this . listener . channelInactive ( ctx ) ; super . channelInactive ( ctx ) ; } | Handles the channel inactive event . | 42 | 7 |
43,279 | @ Override public void exceptionCaught ( final ChannelHandlerContext ctx , final Throwable cause ) { final Channel channel = ctx . channel ( ) ; LOG . log ( Level . INFO , "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}" , new Object [ ] { channel , channel . localAddress ( ) , channel . remo... | Handles the exception event . | 127 | 6 |
43,280 | @ Override public RemoteEvent < T > decode ( final byte [ ] data ) { final WakeMessagePBuf pbuf ; try { pbuf = WakeMessagePBuf . parseFrom ( data ) ; return new RemoteEvent < T > ( null , null , pbuf . getSeq ( ) , decoder . decode ( pbuf . getData ( ) . toByteArray ( ) ) ) ; } catch ( final InvalidProtocolBufferExcept... | Decodes a remote event from the byte array data . | 107 | 11 |
43,281 | public boolean setEvaluatorRestartState ( final EvaluatorRestartState to ) { if ( this . evaluatorRestartState . isLegalTransition ( to ) ) { this . evaluatorRestartState = to ; return true ; } return false ; } | sets the current process of the restart . | 60 | 8 |
43,282 | private static Configuration getCLRTaskConfiguration ( final String taskId ) throws BindException { final ConfigurationBuilder taskConfigurationBuilder = Tang . Factory . getTang ( ) . newConfigurationBuilder ( loadClassHierarchy ( ) ) ; taskConfigurationBuilder . bind ( "Org.Apache.Reef.Tasks.TaskConfigurationOptions+... | Makes a task configuration for the CLR Task . | 256 | 10 |
43,283 | private static ClassHierarchy loadClassHierarchy ( ) { // TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer try ( final InputStream chin = new FileInputStream ( HelloCLR . CLASS_HIERARCHY_FILENAME ) ) { // TODO[JIRA REEF-400] Use AvroClassHierarchySerializer instead final ClassHierarchyProt... | Loads the class hierarchy . | 189 | 6 |
43,284 | void onNextCLR ( final AllocatedEvaluator allocatedEvaluator ) { try { allocatedEvaluator . setProcess ( clrProcessFactory . newEvaluatorProcess ( ) ) ; final Configuration contextConfiguration = ContextConfiguration . CONF . set ( ContextConfiguration . IDENTIFIER , "HelloREEFContext" ) . build ( ) ; final Configurati... | Uses the AllocatedEvaluator to launch a CLR task . | 169 | 15 |
43,285 | void onNextJVM ( final AllocatedEvaluator allocatedEvaluator ) { try { final Configuration contextConfiguration = ContextConfiguration . CONF . set ( ContextConfiguration . IDENTIFIER , "HelloREEFContext" ) . build ( ) ; final Configuration taskConfiguration = TaskConfiguration . CONF . set ( TaskConfiguration . IDENTI... | Uses the AllocatedEvaluator to launch a JVM task . | 172 | 16 |
43,286 | @ Override public Configuration getServiceConfiguration ( ) { final Configuration partialServiceConf = ServiceConfiguration . CONF . set ( ServiceConfiguration . SERVICES , taskOutputStreamProvider . getClass ( ) ) . set ( ServiceConfiguration . ON_CONTEXT_STOP , ContextStopHandler . class ) . set ( ServiceConfiguratio... | Provides a service configuration for the output service . | 168 | 10 |
43,287 | static LocalSubmissionFromCS fromSubmissionParameterFiles ( final File localJobSubmissionParametersFile , final File localAppSubmissionParametersFile ) throws IOException { final AvroLocalAppSubmissionParameters localAppSubmissionParameters ; final AvroLocalJobSubmissionParameters localJobSubmissionParameters ; try ( f... | Takes the local job submission configuration file deserializes it and creates submission object . | 314 | 17 |
43,288 | public static byte [ ] toByteArray ( final ByteString bs ) { return bs == null || bs . isEmpty ( ) ? null : bs . toByteArray ( ) ; } | Converts ByteString to byte array . | 42 | 8 |
43,289 | public static ExceptionInfo createExceptionInfo ( final ExceptionCodec exceptionCodec , final Throwable ex ) { return ExceptionInfo . newBuilder ( ) . setName ( ex . getCause ( ) != null ? ex . getCause ( ) . toString ( ) : ex . toString ( ) ) . setMessage ( StringUtils . isNotEmpty ( ex . getMessage ( ) ) ? ex . getMe... | Create exception info from exception object . | 123 | 7 |
43,290 | public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo ( final EvaluatorDescriptor descriptor ) { if ( descriptor == null ) { return null ; } EvaluatorDescriptorInfo . NodeDescriptorInfo nodeDescriptorInfo = descriptor . getNodeDescriptor ( ) == null ? null : EvaluatorDescriptorInfo . NodeDescriptorInfo . newB... | Create an evaluator descriptor info from an EvalautorDescriptor object . | 322 | 17 |
43,291 | public static ContextInfo toContextInfo ( final ContextBase context , final ExceptionInfo error ) { final ContextInfo . Builder builder = ContextInfo . newBuilder ( ) . setContextId ( context . getId ( ) ) . setEvaluatorId ( context . getEvaluatorId ( ) ) . setParentId ( context . getParentId ( ) . orElse ( "" ) ) . se... | Create a context info from a context object with an error . | 143 | 12 |
43,292 | private Configuration getTaskConfiguration ( final String taskId ) { try { return TaskConfiguration . CONF . set ( TaskConfiguration . IDENTIFIER , taskId ) . set ( TaskConfiguration . TASK , SleepTask . class ) . build ( ) ; } catch ( final BindException ex ) { LOG . log ( Level . SEVERE , "Failed to create Task Confi... | Build a new Task configuration for a given task ID . | 99 | 11 |
43,293 | String waitAndGetMessage ( ) { synchronized ( this ) { // Wait for a message to send. while ( this . statusMessagesToSend . isEmpty ( ) ) { try { this . wait ( ) ; } catch ( final InterruptedException e ) { LOG . log ( Level . FINE , "Interrupted. Ignoring." ) ; } } // Send the message return getMessageForStatus ( this... | Waits for a status message to be available and returns it . | 100 | 13 |
43,294 | @ Override public void addTokens ( final byte [ ] tokens ) { try ( final DataInputBuffer buf = new DataInputBuffer ( ) ) { buf . reset ( tokens , tokens . length ) ; final Credentials credentials = new Credentials ( ) ; credentials . readTokenStorageStream ( buf ) ; final UserGroupInformation ugi = UserGroupInformation... | Add serialized token to teh credentials . | 174 | 9 |
43,295 | public static byte [ ] serializeToken ( final Token < AMRMTokenIdentifier > token ) { try ( final DataOutputBuffer dob = new DataOutputBuffer ( ) ) { final Credentials credentials = new Credentials ( ) ; credentials . addToken ( token . getService ( ) , token ) ; credentials . writeTokenStorageToStream ( dob ) ; return... | Helper method to serialize a security token . | 130 | 9 |
43,296 | @ Override public final synchronized void onHttpRequest ( final ParsedHttpRequest parsedHttpRequest , final HttpServletResponse response ) throws IOException , ServletException { LOG . log ( Level . INFO , "HttpServeShellCmdHandler in webserver onHttpRequest is called: {0}" , parsedHttpRequest . getRequestUri ( ) ) ; f... | it is called when receiving a http request . | 403 | 9 |
43,297 | public final synchronized void onHttpCallback ( final byte [ ] message ) { final long endTime = System . currentTimeMillis ( ) + WAIT_TIMEOUT ; while ( cmdOutput != null ) { final long waitTime = endTime - System . currentTimeMillis ( ) ; if ( waitTime <= 0 ) { break ; } try { wait ( WAIT_TIME ) ; } catch ( final Inter... | called after shell command is completed . | 183 | 7 |
43,298 | public static void runTaskScheduler ( final Configuration runtimeConf , final String [ ] args ) throws InjectionException , IOException , ParseException { final Tang tang = Tang . Factory . getTang ( ) ; final Configuration commandLineConf = CommandLine . parseToConfiguration ( args , Retain . class ) ; // Merge the co... | Run the Task scheduler . If - retain true option is passed via command line the scheduler reuses evaluators to submit new Tasks . | 134 | 30 |
43,299 | @ Override public void start ( final VortexThreadPool vortexThreadPool ) { final List < Matrix < Double > > leftSplits = generateMatrixSplits ( numRows , numColumns , divideFactor ) ; final Matrix < Double > right = generateIdentityMatrix ( numColumns ) ; // Measure job finish time starting from here.. final double sta... | Perform a simple vector multiplication on Vortex . | 398 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.