idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
2,100 | private ComplexCondition allocate ( ) { final ComplexCondition call = freeQueue . poll ( ) ; return call != null ? call : new ComplexCondition ( timeoutPeriod , timeoutUnits ) ; } | Allocate a condition variable . May reuse existing ones . |
2,101 | 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 . |
2,102 | 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 . |
2,103 | 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 . |
2,104 | @ 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 . |
2,105 | 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 . |
2,106 | 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 WakeRuntimeException ( "No e... | Invokes subscribed handlers for the event class type . |
2,107 | 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 . |
2,108 | 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 . |
2,109 | public void onNext ( final T value ) { beforeOnNext ( ) ; executor . submit ( new Runnable ( ) { public void run ( ) { observer . onNext ( value ) ; afterOnNext ( ) ; } } ) ; } | Provides the observer with the new value . |
2,110 | public void onError ( final Exception error ) { submitCompletion ( new Runnable ( ) { public void run ( ) { observer . onError ( error ) ; } } ) ; } | Notifies the observer that the provider has experienced an error condition . |
2,111 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void onNext ( final T value ) { beforeOnNext ( ) ; try { executor . submit ( new Runnable ( ) { public void run ( ) { try { handler . onNext ( value ) ; } catch ( final Throwable t ) { if ( errorHandler != null ) { errorHandler . onNext ( t ) ; } else { LOG . log ... | Handles the event using a thread in the thread pool . |
2,112 | 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 . |
2,113 | 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 . |
2,114 | 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 . |
2,115 | public void unregister ( final Identifier id ) { LOG . log ( Level . FINE , "id: " + id ) ; idToAddrMap . remove ( id ) ; } | Unregisters an identifier locally . |
2,116 | public InetSocketAddress lookup ( final Identifier id ) { LOG . log ( Level . FINE , "id: {0}" , id ) ; return idToAddrMap . get ( id ) ; } | Finds an address for an identifier locally . |
2,117 | 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 . FINEST ... | Finds addresses for identifiers locally . |
2,118 | 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 . |
2,119 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) void startTask ( final Configuration taskConfig ) throws TaskClientCodeException { synchronized ( this . contextLifeCycle ) { if ( this . task . isPresent ( ) && this . task . get ( ) . hasEnded ( ) ) { this . task = Optional . empty ( ) ; } if ( this . task . isPresent ... | Launches a Task on this context . |
2,120 | 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 . |
2,121 | 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 . |
2,122 | 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 . |
2,123 | public void channelInactive ( final ChannelHandlerContext ctx ) throws Exception { this . listener . channelInactive ( ctx ) ; super . channelInactive ( ctx ) ; } | Handles the channel inactive event . |
2,124 | 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 . remoteAddress (... | Handles the exception event . |
2,125 | 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 InvalidProtocolBufferException e ) { t... | Decodes a remote event from the byte array data . |
2,126 | 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 . |
2,127 | 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 . |
2,128 | private static ClassHierarchy loadClassHierarchy ( ) { try ( final InputStream chin = new FileInputStream ( HelloCLR . CLASS_HIERARCHY_FILENAME ) ) { final ClassHierarchyProto . Node root = ClassHierarchyProto . Node . parseFrom ( chin ) ; final ClassHierarchy ch = new ProtocolBufferClassHierarchy ( root ) ; return ch ... | Loads the class hierarchy . |
2,129 | 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 . |
2,130 | 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 . |
2,131 | public Configuration getServiceConfiguration ( ) { final Configuration partialServiceConf = ServiceConfiguration . CONF . set ( ServiceConfiguration . SERVICES , taskOutputStreamProvider . getClass ( ) ) . set ( ServiceConfiguration . ON_CONTEXT_STOP , ContextStopHandler . class ) . set ( ServiceConfiguration . ON_TASK... | Provides a service configuration for the output service . |
2,132 | 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 . |
2,133 | public static byte [ ] toByteArray ( final ByteString bs ) { return bs == null || bs . isEmpty ( ) ? null : bs . toByteArray ( ) ; } | Converts ByteString to byte array . |
2,134 | 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 . |
2,135 | 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 . |
2,136 | 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 . |
2,137 | 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 Conf... | Build a new Task configuration for a given task ID . |
2,138 | String waitAndGetMessage ( ) { synchronized ( this ) { while ( this . statusMessagesToSend . isEmpty ( ) ) { try { this . wait ( ) ; } catch ( final InterruptedException e ) { LOG . log ( Level . FINE , "Interrupted. Ignoring." ) ; } } return getMessageForStatus ( this . statusMessagesToSend . poll ( ) ) ; } } | Waits for a status message to be available and returns it . |
2,139 | 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 . getCurre... | Add serialized token to teh credentials . |
2,140 | 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 . |
2,141 | 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 ( ) ) ; final String... | it is called when receiving a http request . |
2,142 | 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 . |
2,143 | 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 ) ; final Configura... | Run the Task scheduler . If - retain true option is passed via command line the scheduler reuses evaluators to submit new Tasks . |
2,144 | public void start ( final VortexThreadPool vortexThreadPool ) { final List < Matrix < Double > > leftSplits = generateMatrixSplits ( numRows , numColumns , divideFactor ) ; final Matrix < Double > right = generateIdentityMatrix ( numColumns ) ; final double start = System . currentTimeMillis ( ) ; final CountDownLatch ... | Perform a simple vector multiplication on Vortex . |
2,145 | private Matrix < Double > generateRandomMatrix ( final int nRows , final int nColumns ) { final List < List < Double > > rows = new ArrayList < > ( nRows ) ; final Random random = new Random ( ) ; for ( int i = 0 ; i < nRows ; i ++ ) { final List < Double > row = new ArrayList < > ( nColumns ) ; for ( int j = 0 ; j < n... | Generate a matrix with random values . |
2,146 | private Matrix < Double > generateIdentityMatrix ( final int numDimension ) { final List < List < Double > > rows = new ArrayList < > ( numDimension ) ; for ( int i = 0 ; i < numDimension ; i ++ ) { final List < Double > row = new ArrayList < > ( numDimension ) ; for ( int j = 0 ; j < numDimension ; j ++ ) { final doub... | Generate an identity matrix . |
2,147 | public Topology getNewInstance ( final Class < ? extends Name < String > > operatorName , final Class < ? extends Topology > topologyClass ) throws InjectionException { final Injector newInjector = injector . forkInjector ( ) ; newInjector . bindVolatileParameter ( OperatorNameClass . class , operatorName ) ; return ne... | Instantiates a new Topology instance . |
2,148 | public static void main ( final String [ ] args ) throws InjectionException , IOException { final Configuration partialConfiguration = getEnvironmentConfiguration ( ) ; final Injector injector = Tang . Factory . getTang ( ) . newInjector ( partialConfiguration ) ; final AzureBatchRuntimeConfigurationProvider runtimeCon... | Start the Hello REEF job with the Azure Batch runtime . |
2,149 | private void returnResults ( ) { final StringBuilder sb = new StringBuilder ( ) ; for ( final String result : this . results ) { sb . append ( result ) ; } this . results . clear ( ) ; LOG . log ( Level . INFO , "Return results to the client:\n{0}" , sb ) ; httpCallbackHandler . onNext ( CODEC . encode ( sb . toString ... | Construct the final result and forward it to the Client . |
2,150 | private synchronized void submit ( final String command ) { LOG . log ( Level . INFO , "Submit command {0} to {1} evaluators. state: {2}" , new Object [ ] { command , this . contexts . size ( ) , this . state } ) ; assert this . state == State . READY ; this . expectCount = this . contexts . size ( ) ; this . state = S... | Submit command to all available evaluators . |
2,151 | private synchronized void requestEvaluators ( ) { assert this . state == State . INIT ; LOG . log ( Level . INFO , "Schedule on {0} Evaluators." , this . numEvaluators ) ; this . evaluatorRequestor . newRequest ( ) . setMemory ( 128 ) . setNumberOfCores ( 1 ) . setNumber ( this . numEvaluators ) . submit ( ) ; this . s... | Request the evaluators . |
2,152 | private void submit ( final ActiveContext context ) { try { LOG . log ( Level . INFO , "Send task to context: {0}" , new Object [ ] { context } ) ; if ( JobDriver . this . handlerManager . getActiveContextHandler ( ) == 0 ) { throw new RuntimeException ( "Active Context Handler not initialized by CLR." ) ; } final Acti... | Submit a Task to a single Evaluator . |
2,153 | private static String readFile ( final String fileName ) throws IOException { return new String ( Files . readAllBytes ( Paths . get ( fileName ) ) , StandardCharsets . UTF_8 ) ; } | read a file and output it as a String . |
2,154 | private void writeEvaluatorInfoJsonOutput ( final HttpServletResponse response , final List < String > ids ) throws IOException { try { final EvaluatorInfoSerializer serializer = Tang . Factory . getTang ( ) . newInjector ( ) . getInstance ( EvaluatorInfoSerializer . class ) ; final AvroEvaluatorsInfo evaluatorsInfo = ... | Write Evaluator info as JSON format to HTTP Response . |
2,155 | private void writeEvaluatorInfoWebOutput ( final HttpServletResponse response , final List < String > ids ) throws IOException { for ( final String id : ids ) { final EvaluatorDescriptor evaluatorDescriptor = this . reefStateManager . getEvaluators ( ) . get ( id ) ; final PrintWriter writer = response . getWriter ( ) ... | Write Evaluator info on the Response so that to display on web page directly . This is for direct browser queries . |
2,156 | private void writeEvaluatorsJsonOutput ( final HttpServletResponse response ) throws IOException { LOG . log ( Level . INFO , "HttpServerReefEventHandler writeEvaluatorsJsonOutput is called" ) ; try { final EvaluatorListSerializer serializer = Tang . Factory . getTang ( ) . newInjector ( ) . getInstance ( EvaluatorList... | Get all evaluator ids and send it back to response as JSON . |
2,157 | private void writeEvaluatorsWebOutput ( final HttpServletResponse response ) throws IOException { LOG . log ( Level . INFO , "HttpServerReefEventHandler writeEvaluatorsWebOutput is called" ) ; final PrintWriter writer = response . getWriter ( ) ; writer . println ( "<h1>Evaluators:</h1>" ) ; for ( final Map . Entry < S... | Get all evaluator ids and send it back to response so that can be displayed on web . |
2,158 | private void writeDriverJsonInformation ( final HttpServletResponse response ) throws IOException { LOG . log ( Level . INFO , "HttpServerReefEventHandler writeDriverJsonInformation invoked." ) ; try { final DriverInfoSerializer serializer = Tang . Factory . getTang ( ) . newInjector ( ) . getInstance ( DriverInfoSeria... | Write Driver Info as JSON string to Response . |
2,159 | private void writeResponse ( final HttpServletResponse response , final String data ) throws IOException { final byte [ ] outputBody = data . getBytes ( StandardCharsets . UTF_8 ) ; response . getOutputStream ( ) . write ( outputBody ) ; } | Write a String to HTTP Response . |
2,160 | private void writeDriverWebInformation ( final HttpServletResponse response ) throws IOException { LOG . log ( Level . INFO , "HttpServerReefEventHandler writeDriverWebInformation invoked." ) ; final PrintWriter writer = response . getWriter ( ) ; writer . println ( "<h1>Driver Information:</h1>" ) ; writer . println (... | Get driver information . |
2,161 | private void writeLines ( final HttpServletResponse response , final ArrayList < String > lines , final String header ) throws IOException { LOG . log ( Level . INFO , "HttpServerReefEventHandler writeLines is called" ) ; final PrintWriter writer = response . getWriter ( ) ; writer . println ( "<h1>" + header + "</h1>"... | Write lines in ArrayList to the response writer . |
2,162 | public void close ( ) { LOG . log ( Level . FINE , "Closing netty transport socket address: {0}" , this . localAddress ) ; final ChannelGroupFuture clientChannelGroupFuture = this . clientChannelGroup . close ( ) ; final ChannelGroupFuture serverChannelGroupFuture = this . serverChannelGroup . close ( ) ; final Channel... | Closes all channels and releases all resources . |
2,163 | public < T > Link < T > get ( final SocketAddress remoteAddr ) { final LinkReference linkRef = this . addrToLinkRefMap . get ( remoteAddr ) ; return linkRef != null ? ( Link < T > ) linkRef . getLink ( ) : null ; } | Returns a link for the remote address if already cached ; otherwise returns null . |
2,164 | public void registerErrorHandler ( final EventHandler < Exception > handler ) { this . clientEventListener . registerErrorHandler ( handler ) ; this . serverEventListener . registerErrorHandler ( handler ) ; } | Registers the exception event handler . |
2,165 | @ SuppressWarnings ( "checkstyle:diamondoperatorforvariabledefinition" ) public AutoCloseable registerHandler ( final RemoteIdentifier sourceIdentifier , final Class < ? extends T > messageType , final EventHandler < ? super T > theHandler ) { final Tuple2 < RemoteIdentifier , Class < ? extends T > > tuple = new Tuple2... | Subscribe for events from a given source and message type . |
2,166 | public AutoCloseable registerHandler ( final Class < ? extends T > messageType , final EventHandler < RemoteMessage < ? extends T > > theHandler ) { this . msgTypeToHandlerMap . put ( messageType , theHandler ) ; LOG . log ( Level . FINER , "Add handler for class: {0}" , messageType . getCanonicalName ( ) ) ; return ne... | Subscribe for events of a given message type . |
2,167 | public AutoCloseable registerErrorHandler ( final EventHandler < Exception > theHandler ) { this . transport . registerErrorHandler ( theHandler ) ; return new SubscriptionHandler < > ( new Exception ( "Token for finding the error handler subscription" ) , this . unsubscribeException ) ; } | Specify handler for error messages . |
2,168 | public void unsubscribe ( final Subscription < T > subscription ) { final T token = subscription . getToken ( ) ; LOG . log ( Level . FINER , "RemoteManager: {0} token {1}" , new Object [ ] { this . name , token } ) ; if ( token instanceof Exception ) { this . transport . registerErrorHandler ( null ) ; } else if ( tok... | Unsubscribes a handler . |
2,169 | @ SuppressWarnings ( "checkstyle:diamondoperatorforvariabledefinition" ) public synchronized void onNext ( final RemoteEvent < byte [ ] > value ) { LOG . log ( Level . FINER , "RemoteManager: {0} value: {1}" , new Object [ ] { this . name , value } ) ; final T decodedEvent = this . codec . decode ( value . getEvent ( )... | Dispatch message received from the remote to proper event handler . |
2,170 | public void signal ( ) { if ( lockVar . isHeldByCurrentThread ( ) ) { throw new RuntimeException ( "signal() must not be called on same thread as await()" ) ; } try { lockVar . lock ( ) ; LOG . log ( Level . INFO , "Signalling sleeper..." ) ; isSignal = true ; conditionVar . signal ( ) ; } finally { lockVar . unlock ( ... | Wakes the thread sleeping in ( |
2,171 | public < T > EventHandler < T > getHandler ( final RemoteIdentifier destinationIdentifier , final Class < ? extends T > messageType ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "RemoteManager: {0} destinationIdentifier: {1} messageType: {2}" , new Object [ ] { this . name , destinationIdent... | Returns a proxy event handler for a remote identifier and a message type . |
2,172 | public < T , U extends T > AutoCloseable registerHandler ( final Class < U > messageType , final EventHandler < RemoteMessage < T > > theHandler ) { if ( LOG . isLoggable ( Level . FINE ) ) { LOG . log ( Level . FINE , "RemoteManager: {0} messageType: {1} handler: {2}" , new Object [ ] { this . name , messageType . get... | Registers an event handler for a message type and returns a subscription . |
2,173 | public void onResourceRequested ( final ResourceRequestEvent resourceRequestEvent , final String containerId , final URI jarFileUri ) { try { createAzureBatchTask ( containerId , jarFileUri ) ; this . outstandingResourceRequests . put ( containerId , resourceRequestEvent ) ; this . outstandingResourceRequestCount . inc... | This method is called when a resource is requested . It will add a task to the existing Azure Batch job which is equivalent to requesting a container in Azure Batch . When the request is fulfilled and the evaluator shim is started it will send a message back to the driver which signals that a resource request was fulfi... |
2,174 | public void onNext ( final RemoteMessage < EvaluatorShimProtocol . EvaluatorShimStatusProto > statusMessage ) { EvaluatorShimProtocol . EvaluatorShimStatusProto message = statusMessage . getMessage ( ) ; String containerId = message . getContainerId ( ) ; String remoteId = message . getRemoteIdentifier ( ) ; LOG . log ... | This method is invoked by the RemoteManager when a message from the evaluator shim is received . |
2,175 | public void onClose ( ) { try { this . evaluatorShimCommandChannel . close ( ) ; } catch ( Exception e ) { LOG . log ( Level . WARNING , "An unexpected exception while closing the Evaluator Shim Command channel: {0}" , e ) ; throw new RuntimeException ( e ) ; } } | Closes the evaluator shim remote manager command channel . |
2,176 | public URI generateShimJarFile ( ) { try { Set < FileResource > globalFiles = new HashSet < > ( ) ; final File globalFolder = new File ( this . reefFileNames . getGlobalFolderPath ( ) ) ; final File [ ] filesInGlobalFolder = globalFolder . listFiles ( ) ; for ( final File fileEntry : filesInGlobalFolder != null ? files... | A utility method which builds the evaluator shim JAR file and uploads it to Azure Storage . |
2,177 | private synchronized Path getWritePath ( ) throws IOException { if ( pathToWriteTo == null ) { final boolean originalExists = fileSystem . exists ( changeLogPath ) ; final boolean altExists = fileSystem . exists ( changeLogAltPath ) ; if ( originalExists && altExists ) { final FileStatus originalStatus = fileSystem . g... | Gets the path to write to . |
2,178 | public synchronized void close ( ) throws Exception { if ( this . fileSystem != null && ! this . fsClosed ) { this . fileSystem . close ( ) ; this . fsClosed = true ; } } | Closes the FileSystem . |
2,179 | public byte [ ] call ( final byte [ ] memento ) throws Exception { final ExecutorService schedulerThread = Executors . newSingleThreadExecutor ( ) ; final ExecutorService commandExecutor = Executors . newFixedThreadPool ( numOfThreads ) ; final ConcurrentMap < Integer , Future > futures = new ConcurrentHashMap < > ( ) ... | Starts the scheduler and executor and waits until termination . |
2,180 | public InetSocketAddress get ( final Identifier key , final Callable < InetSocketAddress > valueFetcher ) throws ExecutionException { return cache . get ( key , valueFetcher ) ; } | Gets an address for an identifier . |
2,181 | void onResourceReleaseRequest ( final ResourceReleaseEvent releaseRequest ) { synchronized ( this . theContainers ) { LOG . log ( Level . FINEST , "Release container: {0}" , releaseRequest . getIdentifier ( ) ) ; this . theContainers . release ( releaseRequest . getIdentifier ( ) ) ; this . checkRequestQueue ( ) ; } } | Receives and processes a resource release request . |
2,182 | void onResourceLaunchRequest ( final ResourceLaunchEvent launchRequest ) { synchronized ( this . theContainers ) { final Container c = this . theContainers . get ( launchRequest . getIdentifier ( ) ) ; try ( final LoggingScope lb = this . loggingScopeFactory . getNewLoggingScope ( "ResourceManager.onResourceLaunchReque... | Processes a resource launch request . |
2,183 | public Identifier getNewInstance ( final String str ) { final int index = str . indexOf ( "://" ) ; if ( index < 0 ) { throw new RemoteRuntimeException ( "Invalid remote identifier name: " + str ) ; } final String type = str . substring ( 0 , index ) ; final Class < ? extends Identifier > clazz = typeToClazzMap . get (... | Creates a new remote identifier instance . |
2,184 | static Codec < NamingMessage > createLookupCodec ( final IdentifierFactory factory ) { final Map < Class < ? extends NamingMessage > , Codec < ? extends NamingMessage > > clazzToCodecMap = new HashMap < > ( ) ; clazzToCodecMap . put ( NamingLookupRequest . class , new NamingLookupRequestCodec ( factory ) ) ; clazzToCod... | Creates a codec only for lookup . |
2,185 | static Codec < NamingMessage > createRegistryCodec ( final IdentifierFactory factory ) { final Map < Class < ? extends NamingMessage > , Codec < ? extends NamingMessage > > clazzToCodecMap = new HashMap < > ( ) ; clazzToCodecMap . put ( NamingRegisterRequest . class , new NamingRegisterRequestCodec ( factory ) ) ; claz... | Creates a codec only for registration . |
2,186 | static Codec < NamingMessage > createFullCodec ( final IdentifierFactory factory ) { final Map < Class < ? extends NamingMessage > , Codec < ? extends NamingMessage > > clazzToCodecMap = new HashMap < > ( ) ; clazzToCodecMap . put ( NamingLookupRequest . class , new NamingLookupRequestCodec ( factory ) ) ; clazzToCodec... | Creates a codec for both lookup and registration . |
2,187 | public void submit ( final Configuration runtimeConfiguration , final String jobName ) throws Exception { final Configuration driverConfiguration = getDriverConfiguration ( jobName ) ; Tang . Factory . getTang ( ) . newInjector ( runtimeConfiguration ) . getInstance ( REEF . class ) . submit ( driverConfiguration ) ; } | Runs BGD on the given runtime . |
2,188 | public LauncherStatus run ( final Configuration runtimeConfiguration , final String jobName , final int timeout ) throws Exception { final Configuration driverConfiguration = getDriverConfiguration ( jobName ) ; return DriverLauncher . getLauncher ( runtimeConfiguration ) . run ( driverConfiguration , timeout ) ; } | Runs BGD on the given runtime - with timeout . |
2,189 | public AvroDriverInfo toAvro ( final String id , final String startTime , final List < AvroReefServiceInfo > services ) { return AvroDriverInfo . newBuilder ( ) . setRemoteId ( id ) . setStartTime ( startTime ) . setServices ( services ) . build ( ) ; } | Build AvroDriverInfo object . |
2,190 | public void onNext ( final TransportEvent value ) { LOG . log ( Level . FINEST , "{0}" , value ) ; stage . onNext ( value ) ; } | Handles the received event . |
2,191 | public void onNext ( final T event ) { final EventHandler < T > handler = ( EventHandler < T > ) map . get ( event . getClass ( ) ) ; if ( handler == null ) { throw new WakeRuntimeException ( "No event " + event . getClass ( ) + " handler" ) ; } handler . onNext ( event ) ; } | Invokes a specific handler for the event class type if it exists . |
2,192 | public void close ( ) { LOG . log ( Level . FINE , "EvaluatorIdlenessThreadPool shutdown: begin" ) ; this . executor . shutdown ( ) ; boolean isTerminated = false ; try { isTerminated = this . executor . awaitTermination ( this . waitInMillis , TimeUnit . MILLISECONDS ) ; } catch ( final InterruptedException ex ) { LOG... | Shutdown the thread pool of idleness checkers . |
2,193 | public EvaluatorContext newContext ( final String contextId , final Optional < String > parentID ) { synchronized ( this . priorIds ) { if ( this . priorIds . contains ( contextId ) ) { throw new IllegalStateException ( "Creating second EvaluatorContext instance for id " + contextId ) ; } this . priorIds . add ( contex... | Instantiate a new Context representer with the given id and parent id . |
2,194 | public MultiRuntimeDefinitionBuilder addRuntime ( final Configuration config , final String runtimeName ) { Validate . notNull ( config , "runtime configuration module should not be null" ) ; Validate . isTrue ( StringUtils . isNotBlank ( runtimeName ) , "runtimeName should be non empty and non blank string" ) ; final ... | Adds runtime configuration module to the builder . |
2,195 | public MultiRuntimeDefinitionBuilder setDefaultRuntimeName ( final String runtimeName ) { Validate . isTrue ( StringUtils . isNotBlank ( runtimeName ) , "runtimeName should be non empty and non blank string" ) ; this . defaultRuntime = runtimeName ; return this ; } | Sets default runtime name . |
2,196 | public AvroMultiRuntimeDefinition build ( ) { Validate . isTrue ( this . runtimes . size ( ) == 1 || ! StringUtils . isEmpty ( this . defaultRuntime ) , "Default runtime " + "should be set if more than a single runtime provided" ) ; if ( StringUtils . isEmpty ( this . defaultRuntime ) ) { this . defaultRuntime = this .... | Builds multi runtime definition . |
2,197 | void copyTo ( final File destinationFolder ) throws IOException { for ( final File f : this . theFiles ) { final File destinationFile = new File ( destinationFolder , f . getName ( ) ) ; Files . copy ( f . toPath ( ) , destinationFile . toPath ( ) , java . nio . file . StandardCopyOption . REPLACE_EXISTING ) ; } } | Copies all files in the current FileSet to the given destinationFolder . |
2,198 | void createSymbolicLinkTo ( final File destinationFolder ) throws IOException { for ( final File f : this . theFiles ) { final File destinationFile = new File ( destinationFolder , f . getName ( ) ) ; Files . createSymbolicLink ( destinationFile . toPath ( ) , f . toPath ( ) ) ; } } | Creates symbolic links for the current FileSet into the given destinationFolder . |
2,199 | ConfigurationModule addNamesTo ( final ConfigurationModule input , final OptionalParameter < String > field ) { ConfigurationModule result = input ; for ( final String fileName : this . fileNames ( ) ) { result = result . set ( field , fileName ) ; } return result ; } | Adds the file names of this FileSet to the given field of the given ConfigurationModule . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.