idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
43,100 | public synchronized void onError ( final Throwable exception ) { LOG . entering ( CLASS_NAME , "onError" , exception ) ; if ( this . isClosing ( ) ) { LOG . log ( Level . WARNING , "Received an exception while already in shutdown." , exception ) ; } else { LOG . log ( Level . WARNING , "Shutting down the Driver with an... | End the Driver with an exception . | 139 | 7 |
43,101 | public synchronized void onComplete ( ) { LOG . entering ( CLASS_NAME , "onComplete" ) ; if ( this . isClosing ( ) ) { LOG . log ( Level . WARNING , "Ignoring second call to onComplete()" , new Exception ( "Dummy exception to get the call stack" ) ) ; } else { LOG . log ( Level . INFO , "Clean shutdown of the Driver." ... | Perform a clean shutdown of the Driver . | 175 | 9 |
43,102 | private synchronized void setStatus ( final DriverStatus toStatus ) { if ( this . driverStatus . isLegalTransition ( toStatus ) ) { this . driverStatus = toStatus ; } else { LOG . log ( Level . WARNING , "Illegal state transition: {0} -> {1}" , new Object [ ] { this . driverStatus , toStatus } ) ; } } | Helper method to set the status . This also checks whether the transition from the current status to the new one is legal . | 80 | 24 |
43,103 | @ Override public BatchCredentials getCredentials ( ) { final TokenCredentials tokenCredentials = new TokenCredentials ( null , System . getenv ( AZ_BATCH_AUTH_TOKEN_ENV ) ) ; return new BatchCredentials ( ) { @ Override public String baseUrl ( ) { return azureBatchAccountUri ; } @ Override public void applyCredentials... | Returns credentials for Azure Batch account . | 123 | 8 |
43,104 | < T > Link < NetworkConnectionServiceMessage < T > > openLink ( final Identifier connectionFactoryId , final Identifier remoteEndPointId ) throws NetworkException { final Identifier remoteId = getEndPointIdWithConnectionFactoryId ( connectionFactoryId , remoteEndPointId ) ; try { final SocketAddress address = nameResol... | Open a channel for destination identifier of NetworkConnectionService . | 138 | 11 |
43,105 | @ Override public < T > ConnectionFactory < T > getConnectionFactory ( final Identifier connFactoryId ) { final ConnectionFactory < T > connFactory = connFactoryMap . get ( connFactoryId . toString ( ) ) ; if ( connFactory == null ) { throw new RuntimeException ( "Cannot find ConnectionFactory of " + connFactoryId + ".... | Gets a ConnectionFactory . | 85 | 6 |
43,106 | @ Override public < TInput , TOutput > VortexFuture < TOutput > enqueueTasklet ( final VortexFunction < TInput , TOutput > function , final TInput input , final Optional < FutureCallback < TOutput > > callback ) { // TODO[REEF-500]: Simple duplicate Vortex Tasklet launch. final VortexFuture < TOutput > vortexFuture ; f... | Add a new tasklet to pendingTasklets . | 220 | 10 |
43,107 | @ Override public < TInput , TOutput > VortexAggregateFuture < TInput , TOutput > enqueueTasklets ( final VortexAggregateFunction < TOutput > aggregateFunction , final VortexFunction < TInput , TOutput > vortexFunction , final VortexAggregatePolicy policy , final List < TInput > inputs , final Optional < FutureCallback... | Add aggregate - able Tasklets to pendingTasklets . | 419 | 11 |
43,108 | @ Override public void workerPreempted ( final String id ) { final Optional < Collection < Tasklet > > preemptedTasklets = runningWorkers . removeWorker ( id ) ; if ( preemptedTasklets . isPresent ( ) ) { for ( final Tasklet tasklet : preemptedTasklets . get ( ) ) { pendingTasklets . addFirst ( tasklet ) ; } } } | Remove the worker from runningWorkers and add back the lost tasklets to pendingTasklets . | 85 | 19 |
43,109 | private synchronized void putDelegate ( final List < Tasklet > tasklets , final VortexFutureDelegate delegate ) { for ( final Tasklet tasklet : tasklets ) { taskletFutureMap . put ( tasklet . getId ( ) , delegate ) ; } } | Puts a delegate to associate with a Tasklet . | 56 | 11 |
43,110 | private synchronized VortexFutureDelegate fetchDelegate ( final List < Integer > taskletIds ) { VortexFutureDelegate delegate = null ; for ( final int taskletId : taskletIds ) { final VortexFutureDelegate currDelegate = taskletFutureMap . remove ( taskletId ) ; if ( currDelegate == null ) { // TODO[JIRA REEF-500]: Cons... | Fetches a delegate that maps to the list of Tasklets . | 140 | 14 |
43,111 | private File makeGlobalJar ( ) throws IOException { final File jarFile = new File ( this . fileNames . getGlobalFolderName ( ) + this . fileNames . getJarFileSuffix ( ) ) ; new JARFileMaker ( jarFile ) . addChildren ( this . fileNames . getGlobalFolder ( ) ) . close ( ) ; return jarFile ; } | Creates the JAR file for upload . | 80 | 9 |
43,112 | @ SuppressWarnings ( "unchecked" ) public static < T > T [ ] nullToEmpty ( final T [ ] array ) { return array == null ? ( T [ ] ) EMPTY_ARRAY : array ; } | Return an empty array if input is null ; works as identity function otherwise . This function is useful in for statements if the iterable can be null . | 50 | 30 |
43,113 | @ Override public void set ( final String name , final UserCredentials other ) throws IOException { throw new RuntimeException ( "Not implemented! Attempt to set user " + name + " from: " + other ) ; } | Copy credentials from another existing user . This method can be called only once per instance . This default implementation should never be called . | 48 | 25 |
43,114 | @ Override public Time scheduleAlarm ( final int offset , final EventHandler < Alarm > handler ) { final Time alarm = new ClientAlarm ( this . timer . getCurrent ( ) + offset , handler ) ; if ( LOG . isLoggable ( Level . FINEST ) ) { final int eventQueueLen ; synchronized ( this . schedule ) { eventQueueLen = this . nu... | Schedule a new Alarm event in offset milliseconds into the future and supply an event handler to be called at that time . | 236 | 25 |
43,115 | @ Override public void stop ( final Throwable exception ) { LOG . entering ( CLASS_NAME , "stop" ) ; synchronized ( this . schedule ) { if ( this . isClosed ) { LOG . log ( Level . FINEST , "Clock has already been closed" ) ; return ; } this . isClosed = true ; this . exceptionCausedStop = exception ; final Time stopEv... | Stop the clock on exception . Remove all other events from the schedule and fire StopTimer event immediately . | 202 | 20 |
43,116 | @ Override public void close ( ) { LOG . entering ( CLASS_NAME , "close" ) ; synchronized ( this . schedule ) { if ( this . isClosed ) { LOG . exiting ( CLASS_NAME , "close" , "Clock has already been closed" ) ; return ; } this . isClosed = true ; final Time stopEvent = new StopTime ( Math . max ( this . timer . getCur... | Wait for all client alarms to finish executing and gracefully shutdown the clock . | 181 | 15 |
43,117 | @ SuppressWarnings ( "checkstyle:hiddenfield" ) private < T extends Time > void subscribe ( final Class < T > eventClass , final Set < EventHandler < T > > handlers ) { for ( final EventHandler < T > handler : handlers ) { LOG . log ( Level . FINEST , "Subscribe: event {0} handler {1}" , new Object [ ] { eventClass . g... | Register event handlers for the given event class . | 109 | 9 |
43,118 | void release ( final String containerId ) { LOG . log ( Level . FINE , "Release container: {0}" , containerId ) ; final Container container = this . containers . removeAndGet ( containerId ) ; this . resourceManager . releaseAssignedContainer ( container . getId ( ) ) ; updateRuntimeStatus ( ) ; } | Release the given container . | 71 | 5 |
43,119 | void onStart ( ) { LOG . log ( Level . FINEST , "YARN registration: begin" ) ; this . nodeManager . init ( this . yarnConf ) ; this . nodeManager . start ( ) ; try { this . yarnProxyUser . doAs ( new PrivilegedExceptionAction < Object > ( ) { @ Override public Object run ( ) throws Exception { resourceManager . init ( ... | Start the YARN container manager . This method is called from DriverRuntimeStartHandler via YARNRuntimeStartHandler . | 370 | 25 |
43,120 | void onStop ( final Throwable exception ) { LOG . log ( Level . FINE , "Stop Runtime: RM status {0}" , this . resourceManager . getServiceState ( ) ) ; if ( this . resourceManager . getServiceState ( ) == Service . STATE . STARTED ) { // invariant: if RM is still running then we declare success. try { this . reefEventH... | Shut down YARN container manager . This method is called from DriverRuntimeStopHandler via YARNRuntimeStopHandler . | 430 | 25 |
43,121 | private void onContainerStatus ( final ContainerStatus value ) { final String containerId = value . getContainerId ( ) . toString ( ) ; final boolean hasContainer = this . containers . hasContainer ( containerId ) ; if ( hasContainer ) { LOG . log ( Level . FINE , "Received container status: {0}" , containerId ) ; fina... | Handles container status reports . Calls come from YARN . | 344 | 13 |
43,122 | private void handleNewContainer ( final Container container ) { LOG . log ( Level . FINE , "allocated container: id[ {0} ]" , container . getId ( ) ) ; synchronized ( this ) { if ( ! matchContainerWithPendingRequest ( container ) ) { LOG . log ( Level . WARNING , "Got an extra container {0} that doesn't match, releasin... | Handles new container allocations . Calls come from YARN . | 625 | 13 |
43,123 | private boolean matchContainerWithPendingRequest ( final Container container ) { if ( this . requestsAfterSentToRM . isEmpty ( ) ) { return false ; } final AMRMClient . ContainerRequest request = this . requestsAfterSentToRM . peek ( ) ; final boolean resourceCondition = container . getResource ( ) . getMemory ( ) >= r... | Match to see whether the container satisfies the request . We take into consideration that RM has some freedom in rounding up the allocation and in placing containers on other machines . | 223 | 32 |
43,124 | private void updateRuntimeStatus ( ) { final RuntimeStatusEventImpl . Builder builder = RuntimeStatusEventImpl . newBuilder ( ) . setName ( RUNTIME_NAME ) . setState ( State . RUNNING ) . setOutstandingContainerRequests ( this . containerRequestCounter . get ( ) ) ; for ( final String allocatedContainerId : this . cont... | Update the driver with my current status . | 115 | 8 |
43,125 | private void refreshEffectiveTopology ( ) throws ParentDeadException { LOG . entering ( "OperatorTopologyImpl" , "refreshEffectiveTopology" , getQualifiedName ( ) ) ; LOG . finest ( getQualifiedName ( ) + "Waiting to acquire topoLock" ) ; synchronized ( topologyLock ) { LOG . finest ( getQualifiedName ( ) + "Acquired t... | Only refreshes the effective topology with deletion msgs from . deletionDeltas queue | 222 | 18 |
43,126 | public void write ( final Writer outputWriter ) throws IOException { try ( final DataInputStream keyStream = entry . getKeyStream ( ) ; final DataInputStream valueStream = entry . getValueStream ( ) ; ) { outputWriter . write ( "Container: " ) ; outputWriter . write ( keyStream . readUTF ( ) ) ; outputWriter . write ( ... | Writes the contents of the entry into the given outputWriter . | 96 | 13 |
43,127 | public void write ( final File folder ) throws IOException { try ( final DataInputStream keyStream = entry . getKeyStream ( ) ; final DataInputStream valueStream = entry . getValueStream ( ) ; ) { final String containerId = keyStream . readUTF ( ) ; try ( final Writer outputWriter = new OutputStreamWriter ( new FileOut... | Writes the logs stored in the entry as text files in folder one per container . | 116 | 17 |
43,128 | private void writeFiles ( final DataInputStream valueStream , final Writer outputWriter ) throws IOException { while ( valueStream . available ( ) > 0 ) { final String strFileName = valueStream . readUTF ( ) ; final int entryLength = Integer . parseInt ( valueStream . readUTF ( ) ) ; outputWriter . write ( "===========... | Writes the logs of the next container to the given writer . Assumes that the valueStream is suitably positioned . | 160 | 24 |
43,129 | private void write ( final DataInputStream stream , final Writer outputWriter , final int numberOfBytes ) throws IOException { final byte [ ] buf = new byte [ 65535 ] ; int lenRemaining = numberOfBytes ; while ( lenRemaining > 0 ) { final int len = stream . read ( buf , 0 , lenRemaining > 65535 ? 65535 : lenRemaining )... | Writes the next numberOfBytes bytes from the stream to the outputWriter assuming that the bytes are UTF - 8 encoded characters . | 126 | 26 |
43,130 | @ Override public void set ( final String name , final UserCredentials hostUser ) throws IOException { assert this . proxyUGI == null ; assert hostUser instanceof YarnProxyUser ; LOG . log ( Level . FINE , "UGI: user {0} copy from: {1}" , new Object [ ] { name , hostUser } ) ; final UserGroupInformation hostUGI = ( ( Y... | Set YARN user . This method can be called only once per class instance . | 160 | 17 |
43,131 | @ SafeVarargs public final void set ( final String proxyName , final UserGroupInformation hostUGI , final Token < ? extends TokenIdentifier > ... tokens ) { assert this . proxyUGI == null ; this . proxyUGI = UserGroupInformation . createProxyUser ( proxyName , hostUGI ) ; for ( final Token < ? extends TokenIdentifier >... | Create YARN proxy user and add security tokens to its credentials . This method can be called only once per class instance . | 132 | 25 |
43,132 | public < T > T doAs ( final PrivilegedExceptionAction < T > action ) throws Exception { LOG . log ( Level . FINE , "{0} execute {1}" , new Object [ ] { this , action } ) ; return this . proxyUGI == null ? action . run ( ) : this . proxyUGI . doAs ( action ) ; } | Execute the privileged action as a given user . If user credentials are not set execute the action outside the user context . | 77 | 24 |
43,133 | @ Override public byte [ ] call ( final byte [ ] memento ) { LOG . log ( Level . FINE , "Task started: sleep for: {0} msec." , this . delay ) ; final long ts = System . currentTimeMillis ( ) ; for ( long period = this . delay ; period > 0 ; period -= System . currentTimeMillis ( ) - ts ) { try { Thread . sleep ( period... | Sleep for delay milliseconds and return . | 161 | 7 |
43,134 | JobSubmissionEventImpl . Builder getJobSubmissionBuilder ( final Configuration driverConfiguration ) throws InjectionException , IOException { final Injector injector = Tang . Factory . getTang ( ) . newInjector ( driverConfiguration ) ; final boolean preserveEvaluators = injector . getNamedInstance ( ResourceManagerPr... | Fils out a JobSubmissionProto based on the driver configuration given . | 543 | 16 |
43,135 | private static FileResource getFileResourceProto ( final String fileName , final FileType type ) throws IOException { File file = new File ( fileName ) ; if ( file . exists ( ) ) { // It is a local file and can be added. if ( file . isDirectory ( ) ) { // If it is a directory, create a JAR file of it and add that inste... | Turns a pathname into the right protocol for job submission . | 292 | 13 |
43,136 | private static File toJar ( final File file ) throws IOException { final File tempFolder = Files . createTempDirectory ( "reef-tmp-tempFolder" ) . toFile ( ) ; final File jarFile = File . createTempFile ( file . getCanonicalFile ( ) . getName ( ) , ".jar" , tempFolder ) ; LOG . log ( Level . FINEST , "Adding contents o... | Turns temporary folder foo into a jar file foo . jar . | 145 | 13 |
43,137 | private static Throwable getThrowable ( final RuntimeErrorProto error ) { final byte [ ] data = getData ( error ) ; if ( data != null ) { try { return CODEC . decode ( data ) ; } catch ( final RemoteRuntimeException ex ) { LOG . log ( Level . FINE , "Could not decode exception {0}: {1}" , new Object [ ] { error , ex } ... | Retrieve Java exception from protobuf object if possible . Otherwise return null . This is a utility method used in the FailedRuntime constructor . | 95 | 28 |
43,138 | public ApplicationID getApplicationID ( ) throws IOException { final String url = "ws/v1/cluster/apps/new-application" ; final HttpPost post = preparePost ( url ) ; try ( final CloseableHttpResponse response = this . httpClient . execute ( post , this . httpClientContext ) ) { final String message = IOUtils . toString ... | Request an ApplicationId from the cluster . | 122 | 8 |
43,139 | public void submitApplication ( final ApplicationSubmission applicationSubmission ) throws IOException { final String url = "ws/v1/cluster/apps" ; final HttpPost post = preparePost ( url ) ; final StringWriter writer = new StringWriter ( ) ; try { this . objectMapper . writeValue ( writer , applicationSubmission ) ; } ... | Submits an application for execution . | 245 | 7 |
43,140 | public void killApplication ( final String applicationId ) throws IOException { final String url = this . getApplicationURL ( applicationId ) + "/state" ; final HttpPut put = preparePut ( url ) ; put . setEntity ( new StringEntity ( APPLICATION_KILL_MESSAGE , ContentType . APPLICATION_JSON ) ) ; this . httpClient . exe... | Issues a YARN kill command to the application . | 91 | 12 |
43,141 | public ApplicationState getApplication ( final String applicationId ) throws IOException { final String url = this . getApplicationURL ( applicationId ) ; final HttpGet get = prepareGet ( url ) ; try ( final CloseableHttpResponse response = this . httpClient . execute ( get , this . httpClientContext ) ) { final String... | Gets the application state given a YARN application ID . | 125 | 13 |
43,142 | private HttpGet prepareGet ( final String url ) { final HttpGet httpGet = new HttpGet ( this . instanceUrl + url ) ; for ( final Header header : this . headers ) { httpGet . addHeader ( header ) ; } return httpGet ; } | Creates a HttpGet request with all the common headers . | 58 | 13 |
43,143 | private HttpPost preparePost ( final String url ) { final HttpPost httpPost = new HttpPost ( this . instanceUrl + url ) ; for ( final Header header : this . headers ) { httpPost . addHeader ( header ) ; } return httpPost ; } | Creates a HttpPost request with all the common headers . | 58 | 13 |
43,144 | private HttpPut preparePut ( final String url ) { final HttpPut httpPut = new HttpPut ( this . instanceUrl + url ) ; for ( final Header header : this . headers ) { httpPut . addHeader ( header ) ; } return httpPut ; } | Creates a HttpPut request with all the common headers . | 58 | 13 |
43,145 | @ Override public void onNext ( final Alarm alarm ) { String jobId = this . azureBatchHelper . getAzureBatchJobId ( ) ; List < CloudTask > allTasks = this . azureBatchHelper . getTaskStatusForJob ( jobId ) ; // Report status if the task has an associated active container. LOG . log ( Level . FINER , "Found {0} tasks fr... | This method is periodically invoked by the Runtime Clock . It will call Azure Batch APIs to determine the status of tasks running inside the job and notify REEF of tasks statuses that correspond to running evaluators . | 607 | 43 |
43,146 | public synchronized void enableAlarm ( ) { if ( ! this . isAlarmEnabled ) { LOG . log ( Level . FINE , "Enabling the alarm and scheduling it to fire in {0} ms." , this . taskStatusCheckPeriod ) ; this . isAlarmEnabled = true ; this . scheduleAlarm ( ) ; } else { LOG . log ( Level . FINE , "Alarm is already enabled." ) ... | Enable the period alarm to send status updates . | 95 | 9 |
43,147 | public synchronized int submitCommand ( final String command ) { final Integer id = scheduler . assignTaskId ( ) ; scheduler . addTask ( new TaskEntity ( id , command ) ) ; if ( state == State . READY ) { notify ( ) ; // Wake up at {waitForCommands} } else if ( state == State . RUNNING && nMaxEval > nActiveEval + nRequ... | Submit a command to schedule . | 106 | 6 |
43,148 | public synchronized int setMaxEvaluators ( final int targetNum ) throws UnsuccessfulException { if ( targetNum < nActiveEval + nRequestedEval ) { throw new UnsuccessfulException ( nActiveEval + nRequestedEval + " evaluators are used now. Should be larger than that." ) ; } nMaxEval = targetNum ; if ( scheduler . hasPend... | Update the maximum number of evaluators to hold . Request more evaluators in case there are pending tasks in the queue and the number of evaluators is less than the limit . | 151 | 38 |
43,149 | private synchronized void requestEvaluator ( final int numToRequest ) { if ( numToRequest <= 0 ) { throw new IllegalArgumentException ( "The number of evaluator request should be a positive integer" ) ; } nRequestedEval += numToRequest ; requestor . newRequest ( ) . setMemory ( 32 ) . setNumber ( numToRequest ) . submi... | Request evaluators . Passing a non positive number is illegal so it does not make a trial for that situation . | 86 | 23 |
43,150 | private synchronized void waitForCommands ( final ActiveContext context ) { while ( ! scheduler . hasPendingTasks ( ) ) { // Wait until any command enters in the queue try { wait ( ) ; } catch ( final InterruptedException e ) { LOG . log ( Level . WARNING , "InterruptedException occurred in SchedulerDriver" , e ) ; } }... | Pick up a command from the queue and run it . Wait until any command coming up if no command exists . | 108 | 22 |
43,151 | private synchronized void retainEvaluator ( final ActiveContext context ) { if ( scheduler . hasPendingTasks ( ) ) { scheduler . submitTask ( context ) ; } else if ( nActiveEval > 1 ) { nActiveEval -- ; context . close ( ) ; } else { state = State . READY ; waitForCommands ( context ) ; } } | Retain the complete evaluators submitting another task until there is no need to reuse them . | 82 | 19 |
43,152 | private synchronized void reallocateEvaluator ( final ActiveContext context ) { nActiveEval -- ; context . close ( ) ; if ( scheduler . hasPendingTasks ( ) ) { requestEvaluator ( 1 ) ; } else if ( nActiveEval <= 0 ) { state = State . WAIT_EVALUATORS ; requestEvaluator ( 1 ) ; } } | Always close the complete evaluators and allocate a new evaluator if necessary . | 88 | 17 |
43,153 | Map < String , LocalResource > getResources ( final ResourceLaunchEvent resourceLaunchEvent ) throws IOException { final Map < String , LocalResource > result = new HashMap <> ( ) ; result . putAll ( getGlobalResources ( ) ) ; final File localStagingFolder = this . tempFileCreator . createTempDirectory ( this . fileNam... | Sets up the LocalResources for a new Evaluator . | 521 | 13 |
43,154 | private Configuration makeEvaluatorConfiguration ( final ResourceLaunchEvent resourceLaunchEvent ) throws IOException { return Tang . Factory . getTang ( ) . newConfigurationBuilder ( resourceLaunchEvent . getEvaluatorConf ( ) ) . build ( ) ; } | Assembles the configuration for an Evaluator . | 54 | 11 |
43,155 | public synchronized boolean detectRestart ( ) { if ( this . state . hasNotRestarted ( ) ) { resubmissionAttempts = driverRuntimeRestartManager . getResubmissionAttempts ( ) ; if ( resubmissionAttempts > 0 ) { // set the state machine in motion. this . state = DriverRestartState . BEGAN ; } } return this . state . hasRe... | Triggers the state machine if the application is a restart instance . Returns true | 87 | 16 |
43,156 | 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 . | 327 | 50 |
43,157 | 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 . | 244 | 22 |
43,158 | 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 . | 255 | 22 |
43,159 | 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 . | 127 | 19 |
43,160 | 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 . | 159 | 6 |
43,161 | 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 . | 598 | 7 |
43,162 | @ 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 . | 476 | 11 |
43,163 | 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 . | 88 | 12 |
43,164 | 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 . | 37 | 13 |
43,165 | 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 . | 39 | 15 |
43,166 | 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 . | 158 | 10 |
43,167 | public void read ( final byte [ ] messageBytes , final MultiObserver observer ) { try ( final InputStream inputStream = new ByteArrayInputStream ( messageBytes ) ) { // Binary decoder for both the header and the message. final BinaryDecoder decoder = DecoderFactory . get ( ) . binaryDecoder ( inputStream , null ) ; // ... | Read a message from the input byte stream and send it to the event handler . | 291 | 16 |
43,168 | 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 . | 38 | 21 |
43,169 | private void addYarnRuntimeDefinition ( final AvroYarnJobSubmissionParameters yarnJobSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { // create and serialize yarn configuration if defined final Configuration yarnDriverConfiguration = createYa... | Adds yarn runtime definitions to the builder . | 104 | 8 |
43,170 | private void addDummyYarnRuntimeDefinition ( final AvroYarnJobSubmissionParameters yarnJobSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { // create and serialize yarn configuration if defined final Configuration yarnDriverConfiguration = cre... | 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 . | 109 | 46 |
43,171 | private void addLocalRuntimeDefinition ( final AvroLocalAppSubmissionParameters localAppSubmissionParams , final AvroJobSubmissionParameters jobSubmissionParameters , final MultiRuntimeDefinitionBuilder builder ) { // create and serialize local configuration if defined final Configuration localModule = LocalDriverConfi... | Adds local runtime definitions to the builder . | 285 | 8 |
43,172 | 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 . | 212 | 11 |
43,173 | @ SafeVarargs 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 ( ... | Process command line arguments . | 326 | 5 |
43,174 | @ 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 | 198 | 11 |
43,175 | 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 ++ ) { i... | 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 . | 117 | 53 |
43,176 | @ Private @ Override 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 . | 62 | 10 |
43,177 | @ Private @ Override 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 . | 61 | 16 |
43,178 | @ Private @ Override 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 . | 61 | 10 |
43,179 | @ Private @ Override 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 . | 61 | 11 |
43,180 | 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 . | 127 | 14 |
43,181 | 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 . | 134 | 16 |
43,182 | 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 . | 85 | 10 |
43,183 | @ Override 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 . | 61 | 11 |
43,184 | 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 . | 198 | 19 |
43,185 | 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 . | 510 | 21 |
43,186 | 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 . | 127 | 8 |
43,187 | private synchronized void onEvaluatorDone ( final EvaluatorStatusPOJO message ) { assert message . getState ( ) == State . DONE ; LOG . log ( Level . FINEST , "Evaluator {0} done." , getId ( ) ) ; // Send an ACK to the Evaluator. sendEvaluatorControlMessage ( EvaluatorRuntimeProtocol . EvaluatorControlProto . newBuilde... | Process an evaluator message that indicates that the evaluator shut down cleanly . | 206 | 18 |
43,188 | 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 . | 199 | 11 |
43,189 | 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 . | 84 | 21 |
43,190 | 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 . | 79 | 25 |
43,191 | 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 . | 434 | 5 |
43,192 | @ Override 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 . | 59 | 36 |
43,193 | @ Override 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... | Encodes Hadoop Writable object into a byte array . | 107 | 13 |
43,194 | @ Override 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 IO... | Decode Hadoop Writable object from a byte array . | 131 | 13 |
43,195 | 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 . | 440 | 8 |
43,196 | 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 . | 321 | 12 |
43,197 | 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 . | 164 | 8 |
43,198 | @ Override 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 ( ) ,... | Encodes the identifiers to bytes . | 112 | 7 |
43,199 | @ Override 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 ( fac... | Decodes the bytes to a naming lookup request . | 128 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.