idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
43,000 | public static void validateKey ( final String key , final boolean binary ) { byte [ ] keyBytes = KeyUtil . getKeyBytes ( key ) ; int keyLength = keyBytes . length ; if ( keyLength > MAX_KEY_LENGTH ) { throw KEY_TOO_LONG_EXCEPTION ; } if ( keyLength == 0 ) { throw KEY_EMPTY_EXCEPTION ; } if ( ! binary ) { for ( byte b :... | Check if a given key is valid to transmit . | 151 | 10 |
43,001 | public String getKeyForNode ( MemcachedNode node , int repetition ) { // Carrried over from the DefaultKetamaNodeLocatorConfiguration: // Internal Using the internal map retrieve the socket addresses // for given nodes. // I'm aware that this code is inherently thread-unsafe as // I'm using a HashMap implementation of ... | Returns a uniquely identifying key suitable for hashing by the KetamaNodeLocator algorithm . | 304 | 17 |
43,002 | protected final OperationStatus matchStatus ( String line , OperationStatus ... statii ) { OperationStatus rv = null ; for ( OperationStatus status : statii ) { if ( line . equals ( status . getMessage ( ) ) ) { rv = status ; } } if ( rv == null ) { rv = new OperationStatus ( false , line , StatusCode . fromAsciiLine (... | Match the status line provided against one of the given OperationStatus objects . If none match return a failure status with the given line . | 94 | 26 |
43,003 | protected final void setArguments ( ByteBuffer bb , Object ... args ) { boolean wasFirst = true ; for ( Object o : args ) { if ( wasFirst ) { wasFirst = false ; } else { bb . put ( ( byte ) ' ' ) ; } bb . put ( KeyUtil . getKeyBytes ( String . valueOf ( o ) ) ) ; } bb . put ( CRLF ) ; } | Set some arguments for an operation into the given byte buffer . | 93 | 12 |
43,004 | private Animator preparePressedAnimation ( ) { Animator animation = ObjectAnimator . ofFloat ( drawable , CircularProgressDrawable . CIRCLE_SCALE_PROPERTY , drawable . getCircleScale ( ) , 0.65f ) ; animation . setDuration ( 120 ) ; return animation ; } | This animation was intended to keep a pressed state of the Drawable | 69 | 13 |
43,005 | private Animator preparePulseAnimation ( ) { AnimatorSet animation = new AnimatorSet ( ) ; Animator firstBounce = ObjectAnimator . ofFloat ( drawable , CircularProgressDrawable . CIRCLE_SCALE_PROPERTY , drawable . getCircleScale ( ) , 0.88f ) ; firstBounce . setDuration ( 300 ) ; firstBounce . setInterpolator ( new Cyc... | This animation will make a pulse effect to the inner circle | 269 | 11 |
43,006 | private Animator prepareStyle1Animation ( ) { AnimatorSet animation = new AnimatorSet ( ) ; final Animator indeterminateAnimation = ObjectAnimator . ofFloat ( drawable , CircularProgressDrawable . PROGRESS_PROPERTY , 0 , 3600 ) ; indeterminateAnimation . setDuration ( 3600 ) ; Animator innerCircleAnimation = ObjectAnim... | Style 1 animation will simulate a indeterminate loading while taking advantage of the inner circle to provide a progress sense | 236 | 22 |
43,007 | private Animator prepareStyle2Animation ( ) { AnimatorSet animation = new AnimatorSet ( ) ; ObjectAnimator progressAnimation = ObjectAnimator . ofFloat ( drawable , CircularProgressDrawable . PROGRESS_PROPERTY , 0f , 1f ) ; progressAnimation . setDuration ( 3600 ) ; progressAnimation . setInterpolator ( new AccelerateD... | Style 2 animation will fill the outer ring while applying a color effect from red to green | 216 | 17 |
43,008 | public void installOrUpdateScanner ( File installDirectory ) throws BlackDuckIntegrationException { File scannerExpansionDirectory = new File ( installDirectory , ScannerZipInstaller . BLACK_DUCK_SIGNATURE_SCANNER_INSTALL_DIRECTORY ) ; scannerExpansionDirectory . mkdirs ( ) ; File versionFile = null ; try { versionFile... | The Black Duck Signature Scanner will be download if it has not previously been downloaded or if it has been updated on the server . The absolute path to the install location will be returned if it was downloaded or found successfully otherwise an Optional . empty will be returned and the log will contain details conce... | 232 | 61 |
43,009 | public List < ScanCommand > createScanCommands ( final File defaultInstallDirectory , final ScanPathsUtility scanPathsUtility , final IntEnvironmentVariables intEnvironmentVariables ) throws BlackDuckIntegrationException { String scanCliOptsToUse = scanCliOpts ; if ( null != intEnvironmentVariables && StringUtils . isB... | The default install directory will be used if the batch does not already have an install directory . | 791 | 18 |
43,010 | private String createPrintableCommand ( final List < String > cmd ) { final List < String > cmdToOutput = new ArrayList <> ( ) ; cmdToOutput . addAll ( cmd ) ; int passwordIndex = cmdToOutput . indexOf ( "--password" ) ; if ( passwordIndex > - 1 ) { // The User's password will be at the next index passwordIndex ++ ; } ... | Code to mask passwords in the logs | 196 | 7 |
43,011 | public void populateApplicationId ( ProjectView projectView , String applicationId ) throws IntegrationException { List < ProjectMappingView > projectMappings = blackDuckService . getAllResponses ( projectView , ProjectView . PROJECT_MAPPINGS_LINK_RESPONSE ) ; boolean canCreate = projectMappings . isEmpty ( ) ; if ( ca... | Sets the applicationId for a project | 321 | 8 |
43,012 | public String generateBlackDuckNoticesReport ( ProjectVersionView version , ReportFormatType reportFormat ) throws InterruptedException , IntegrationException { if ( version . hasLink ( ProjectVersionView . LICENSEREPORTS_LINK ) ) { try { logger . debug ( "Starting the Notices Report generation." ) ; String reportUrl =... | Assumes the BOM has already been updated | 361 | 9 |
43,013 | public ReportView isReportFinishedGenerating ( String reportUri ) throws InterruptedException , IntegrationException { long startTime = System . currentTimeMillis ( ) ; long elapsedTime = 0 ; Date timeFinished = null ; ReportView reportInfo = null ; while ( timeFinished == null ) { reportInfo = blackDuckService . getRe... | Checks the report URL every 5 seconds until the report has a finished time available then we know it is done being generated . Throws BlackDuckIntegrationException after 30 minutes if the report has not been generated yet . | 217 | 45 |
43,014 | public Set < UserView > getAllActiveUsersForProject ( ProjectView projectView ) throws IntegrationException { Set < UserView > users = new HashSet <> ( ) ; List < AssignedUserGroupView > assignedGroups = getAssignedGroupsToProject ( projectView ) ; for ( AssignedUserGroupView assignedUserGroupView : assignedGroups ) { ... | This will get all explicitly assigned users for a project as well as all users who are assigned to groups that are explicitly assigned to a project . | 289 | 28 |
43,015 | public String createPolicyRuleForExternalId ( ComponentService componentService , ExternalId externalId , String policyName ) throws IntegrationException { Optional < ComponentVersionView > componentVersionView = componentService . getComponentVersion ( externalId ) ; if ( ! componentVersionView . isPresent ( ) ) { thr... | This will create a policy rule that will be violated by the existence of a matching external id in the project s BOM . | 243 | 25 |
43,016 | public static void kill ( final long pid ) throws IOException , InterruptedException { if ( isUnix ( ) ) { final Process process = new ProcessBuilder ( ) . command ( "bash" , "-c" , "kill" , "-9" , String . valueOf ( pid ) ) . start ( ) ; final int returnCode = process . waitFor ( ) ; LOG . fine ( "Kill returned: " + r... | Kill the process . | 192 | 4 |
43,017 | @ SuppressWarnings ( "checkstyle:hiddenfield" ) public < T , U extends T > void register ( final Class < T > type , final Set < EventHandler < U > > handlers ) { this . handlers . put ( type , new ExceptionHandlingEventHandler <> ( new BroadCastEventHandler <> ( handlers ) , this . errorHandler ) ) ; } | Register a new event handler . | 81 | 6 |
43,018 | @ SuppressWarnings ( "unchecked" ) public < T , U extends T > void onNext ( final Class < T > type , final U message ) { if ( this . isClosed ( ) ) { LOG . log ( Level . WARNING , "Dispatcher {0} already closed: ignoring message {1}: {2}" , new Object [ ] { this . stage , type . getCanonicalName ( ) , message } ) ; } e... | Dispatch a new message by type . If the stage is already closed log a warning and ignore the message . | 145 | 21 |
43,019 | @ Override public InetSocketAddress lookup ( final Identifier id ) throws Exception { return cache . get ( id , new Callable < InetSocketAddress > ( ) { @ Override public InetSocketAddress call ( ) throws Exception { final int origRetryCount = NameLookupClient . this . retryCount ; int retriesLeft = origRetryCount ; wh... | Finds an address for an identifier . | 228 | 8 |
43,020 | public InetSocketAddress remoteLookup ( final Identifier id ) throws Exception { // the lookup is not thread-safe, because concurrent replies may // be read by the wrong thread. // TODO: better fix uses a map of id's after REEF-198 synchronized ( this ) { LOG . log ( Level . INFO , "Looking up {0} on NameServer {1}" , ... | Retrieves an address for an identifier remotely . | 324 | 10 |
43,021 | public void scheduleTasklet ( final int taskletId ) { synchronized ( stateLock ) { // If there are tasklets are pending to be executed, then that means that a // timer has already been scheduled for an aggregation. if ( ! outstandingTasklets ( ) ) { timer . schedule ( new Runnable ( ) { @ Override public void run ( ) {... | Schedule aggregation tasks on a Timer . Creates a new timer schedule for triggering the aggregation function if this is the first time the aggregation function has tasklets scheduled on it . Adds the Tasklet to pending Tasklets . | 328 | 45 |
43,022 | public void taskletComplete ( final int taskletId , final Object result ) { final boolean aggregateOnCount ; synchronized ( stateLock ) { completedTasklets . add ( new ImmutablePair <> ( taskletId , result ) ) ; removePendingTaskletReferenceCount ( taskletId ) ; aggregateOnCount = aggregateOnCount ( ) ; } if ( aggregat... | Reported when an associated tasklet is complete and adds it to the completion pool . | 97 | 17 |
43,023 | public void taskletFailed ( final int taskletId , final Exception e ) { final boolean aggregateOnCount ; synchronized ( stateLock ) { failedTasklets . add ( new ImmutablePair <> ( taskletId , e ) ) ; removePendingTaskletReferenceCount ( taskletId ) ; aggregateOnCount = aggregateOnCount ( ) ; } if ( aggregateOnCount ) {... | Reported when an associated tasklet is complete and adds it to the failure pool . | 98 | 17 |
43,024 | @ Override public void onNext ( final Integer integer ) { while ( ! runningWorkers . isTerminated ( ) ) { try { final Tasklet tasklet = pendingTasklets . takeFirst ( ) ; // blocks when no tasklet exists runningWorkers . launchTasklet ( tasklet ) ; // blocks when no worker exists } catch ( InterruptedException e ) { LOG... | Repeatedly take a tasklet from the pending queue and launch it via RunningWorkers . | 97 | 19 |
43,025 | private String getQueue ( final JobSubmissionEvent jobSubmissionEvent ) { try { return Tang . Factory . getTang ( ) . newInjector ( jobSubmissionEvent . getConfiguration ( ) ) . getNamedInstance ( JobQueue . class ) ; } catch ( final InjectionException e ) { return this . defaultQueueName ; } } | Extract the queue name from the jobSubmissionEvent or return default if none is set . | 74 | 19 |
43,026 | @ Override public void onNext ( final ResourceStatusEvent resourceStatusEvent ) { final String id = resourceStatusEvent . getIdentifier ( ) ; final Optional < EvaluatorManager > evaluatorManager = this . evaluators . get ( id ) ; LOG . log ( Level . FINEST , "Evaluator {0} status: {1}" , new Object [ ] { evaluatorManag... | This resource status message comes from the ResourceManager layer telling me what it thinks about the state of the resource executing an Evaluator . This method simply passes the message off to the referenced EvaluatorManager | 382 | 41 |
43,027 | @ Override public byte [ ] encode ( final NamingLookupResponse obj ) { final List < AvroNamingAssignment > assignments = new ArrayList <> ( obj . getNameAssignments ( ) . size ( ) ) ; for ( final NameAssignment nameAssignment : obj . getNameAssignments ( ) ) { assignments . add ( AvroNamingAssignment . newBuilder ( ) .... | Encodes name assignments to bytes . | 195 | 7 |
43,028 | @ Override public NamingLookupResponse decode ( final byte [ ] buf ) { final AvroNamingLookupResponse avroResponse = AvroUtils . fromBytes ( buf , AvroNamingLookupResponse . class ) ; final List < NameAssignment > nas = new ArrayList <> ( avroResponse . getTuples ( ) . size ( ) ) ; for ( final AvroNamingAssignment tupl... | Decodes bytes to an iterable of name assignments . | 174 | 11 |
43,029 | public List < MonitorInfo > getMonitorLockedElements ( final ThreadInfo threadInfo , final StackTraceElement stackTraceElement ) { final Map < StackTraceElement , List < MonitorInfo > > elementMap = monitorLockedElements . get ( threadInfo ) ; if ( null == elementMap ) { return Collections . EMPTY_LIST ; } final List <... | Get a list of monitor locks that were acquired by this thread at this stack element . | 118 | 17 |
43,030 | @ Nullable public String getWaitingLockString ( final ThreadInfo threadInfo ) { if ( null == threadInfo . getLockInfo ( ) ) { return null ; } else { return threadInfo . getLockName ( ) + " held by " + threadInfo . getLockOwnerName ( ) ; } } | Get a string identifying the lock that this thread is waiting on . | 65 | 13 |
43,031 | private static void storeCommandLineArgs ( final Configuration commandLineConf ) throws InjectionException { final Injector injector = Tang . Factory . getTang ( ) . newInjector ( commandLineConf ) ; local = injector . getNamedInstance ( Local . class ) ; dimensions = injector . getNamedInstance ( ModelDimensions . cla... | copy the parameters from the command line required for the Client configuration . | 101 | 13 |
43,032 | @ Override public byte [ ] encode ( final T obj ) { final Encoder < T > encoder = ( Encoder < T > ) clazzToEncoderMap . get ( obj . getClass ( ) ) ; if ( encoder == null ) { throw new RemoteRuntimeException ( "Encoder for " + obj . getClass ( ) + " not known." ) ; } final WakeTuplePBuf . Builder tupleBuilder = WakeTupl... | Encodes an object to a byte array . | 160 | 9 |
43,033 | @ Override public byte [ ] encode ( final NamingUnregisterRequest obj ) { final AvroNamingUnRegisterRequest result = AvroNamingUnRegisterRequest . newBuilder ( ) . setId ( obj . getIdentifier ( ) . toString ( ) ) . build ( ) ; return AvroUtils . toBytes ( result , AvroNamingUnRegisterRequest . class ) ; } | Encodes the naming un - registration request to bytes . | 85 | 11 |
43,034 | @ Override public NamingUnregisterRequest decode ( final byte [ ] buf ) { final AvroNamingUnRegisterRequest result = AvroUtils . fromBytes ( buf , AvroNamingUnRegisterRequest . class ) ; return new NamingUnregisterRequest ( factory . getNewInstance ( result . getId ( ) . toString ( ) ) ) ; } | Decodes the bytes to a naming un - registration request . | 78 | 12 |
43,035 | public synchronized void sendTaskStatus ( final ReefServiceProtos . TaskStatusProto taskStatusProto ) { this . sendHeartBeat ( this . getEvaluatorHeartbeatProto ( this . evaluatorRuntime . get ( ) . getEvaluatorStatus ( ) , this . contextManager . get ( ) . getContextStatusCollection ( ) , Optional . of ( taskStatusPro... | Called with a specific TaskStatus that must be delivered to the driver . | 90 | 15 |
43,036 | public synchronized void sendContextStatus ( final ReefServiceProtos . ContextStatusProto contextStatusProto ) { // TODO[JIRA REEF-833]: Write a test that verifies correct order of heartbeats. final Collection < ReefServiceProtos . ContextStatusProto > contextStatusList = new ArrayList <> ( ) ; contextStatusList . add ... | Called with a specific ContextStatus that must be delivered to the driver . | 194 | 15 |
43,037 | public synchronized void sendEvaluatorStatus ( final ReefServiceProtos . EvaluatorStatusProto evaluatorStatusProto ) { this . sendHeartBeat ( EvaluatorRuntimeProtocol . EvaluatorHeartbeatProto . newBuilder ( ) . setTimestamp ( System . currentTimeMillis ( ) ) . setEvaluatorStatus ( evaluatorStatusProto ) . build ( ) ) ... | Called with a specific EvaluatorStatus that must be delivered to the driver . | 91 | 17 |
43,038 | private synchronized void sendHeartBeat ( final EvaluatorRuntimeProtocol . EvaluatorHeartbeatProto heartbeatProto ) { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "Heartbeat message:\n" + heartbeatProto , new Exception ( "Stack trace" ) ) ; } this . evaluatorHeartbeatHandler . onNext ( hear... | Sends the actual heartbeat out and logs it if so desired . | 93 | 13 |
43,039 | private synchronized void initialize ( ) { if ( this . runtimes != null ) { return ; } this . runtimes = new HashMap <> ( ) ; for ( final AvroRuntimeDefinition rd : runtimeDefinition . getRuntimes ( ) ) { try { // We need to create different injector for each runtime as they define conflicting bindings. Also we cannot ... | Initializes the configured runtimes . | 363 | 7 |
43,040 | private void initializeInjector ( final Injector runtimeInjector ) throws InjectionException { copyEventHandler ( runtimeInjector , RuntimeParameters . ResourceStatusHandler . class ) ; copyEventHandler ( runtimeInjector , RuntimeParameters . NodeDescriptorHandler . class ) ; copyEventHandler ( runtimeInjector , Runtim... | Initializes injector by copying needed handlers . | 190 | 9 |
43,041 | private Runtime getRuntime ( final String requestedRuntimeName ) { final String runtimeName = StringUtils . isBlank ( requestedRuntimeName ) ? this . defaultRuntimeName : requestedRuntimeName ; final Runtime runtime = this . runtimes . get ( runtimeName ) ; Validate . notNull ( runtime , "Couldn't find runtime for name... | Retrieves requested runtime if requested name is empty a default runtime will be used . | 81 | 17 |
43,042 | public void advanceClock ( final int offset ) { this . currentTime += offset ; final Iterator < Alarm > iter = this . alarmList . iterator ( ) ; while ( iter . hasNext ( ) ) { final Alarm alarm = iter . next ( ) ; if ( alarm . getTimestamp ( ) <= this . currentTime ) { alarm . run ( ) ; iter . remove ( ) ; } } } | Advances the clock by the offset amount . | 87 | 9 |
43,043 | @ Override public byte [ ] call ( final byte [ ] memento ) { LOG . log ( Level . INFO , "RUN: command: {0}" , this . command ) ; final String result = CommandUtils . runCommand ( this . command ) ; LOG . log ( Level . INFO , "RUN: result: {0}" , result ) ; return CODEC . encode ( result ) ; } | Execute the shell command and return the result which is sent back to the JobDriver and surfaced in the CompletedTask object . | 89 | 25 |
43,044 | public synchronized void send ( final EvaluatorRuntimeProtocol . EvaluatorControlProto evaluatorControlProto ) { if ( ! this . wrapped . isPresent ( ) ) { throw new IllegalStateException ( "Trying to send an EvaluatorControlProto before the Evaluator ID is set." ) ; } if ( ! this . stateManager . isRunning ( ) ) { LOG ... | Send the evaluatorControlProto to the Evaluator . | 189 | 14 |
43,045 | synchronized void setRemoteID ( final String evaluatorRID ) { if ( this . wrapped . isPresent ( ) ) { throw new IllegalStateException ( "Trying to reset the evaluator ID. This isn't supported." ) ; } else { LOG . log ( Level . FINE , "Registering remoteId [{0}] for Evaluator [{1}]" , new Object [ ] { evaluatorRID , eva... | Set the remote ID used to communicate with this Evaluator . | 143 | 13 |
43,046 | private String convertTime ( final long time ) { final Date date = new Date ( time ) ; return FORMAT . format ( date ) ; } | convert time from long to formatted string . | 30 | 9 |
43,047 | public JobFolder createJobFolderWithApplicationId ( final String applicationId ) throws IOException { final Path jobFolderPath = jobSubmissionDirectoryProvider . getJobSubmissionDirectoryPath ( applicationId ) ; final String finalJobFolderPath = jobFolderPath . toString ( ) ; LOG . log ( Level . FINE , "Final job submi... | Creates the Job folder on the DFS . | 93 | 10 |
43,048 | public JobFolder createJobFolder ( final String finalJobFolderPath ) throws IOException { LOG . log ( Level . FINE , "Final job submission Directory: " + finalJobFolderPath ) ; return new JobFolder ( this . fileSystem , new Path ( finalJobFolderPath ) ) ; } | Convenience override for int ids . | 62 | 9 |
43,049 | @ Override public void onNext ( final RemoteMessage < EvaluatorShimProtocol . EvaluatorShimControlProto > remoteMessage ) { final EvaluatorShimProtocol . EvaluatorShimCommand command = remoteMessage . getMessage ( ) . getCommand ( ) ; switch ( command ) { case LAUNCH_EVALUATOR : LOG . log ( Level . INFO , "Received a c... | This method is invoked by the Remote Manager when a command message from the Driver is received . | 327 | 18 |
43,050 | @ Override public void unregister ( final Identifier id ) throws IOException { final Link < NamingMessage > link = transport . open ( serverSocketAddr , codec , new LoggingLinkListener < NamingMessage > ( ) ) ; link . write ( new NamingUnregisterRequest ( id ) ) ; } | Unregisters an identifier . | 67 | 6 |
43,051 | public Path upload ( final File localFile ) throws IOException { if ( ! localFile . exists ( ) ) { throw new FileNotFoundException ( localFile . getAbsolutePath ( ) ) ; } final Path source = new Path ( localFile . getAbsolutePath ( ) ) ; final Path destination = new Path ( this . path , localFile . getName ( ) ) ; try ... | Upload given file to the DFS . | 174 | 8 |
43,052 | public LocalResource uploadAsLocalResource ( final File localFile , final LocalResourceType type ) throws IOException { final Path remoteFile = upload ( localFile ) ; return getLocalResourceForPath ( remoteFile , type ) ; } | Shortcut to first upload the file and then form a LocalResource for the YARN submission . | 48 | 20 |
43,053 | @ Override public byte [ ] encode ( final T obj ) { try ( final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; final ObjectOutputStream out = new ObjectOutputStream ( bos ) ) { out . writeObject ( obj ) ; return bos . toByteArray ( ) ; } catch ( final IOException ex ) { throw new RemoteRuntimeException ( e... | Encodes the object to bytes . | 83 | 7 |
43,054 | @ SuppressWarnings ( "unchecked" ) @ Override public T decode ( final byte [ ] buf ) { try ( final ObjectInputStream in = new ObjectInputStream ( new ByteArrayInputStream ( buf ) ) ) { return ( T ) in . readObject ( ) ; } catch ( final ClassNotFoundException | IOException ex ) { throw new RemoteRuntimeException ( ex ) ... | Decodes an object from the bytes . | 86 | 8 |
43,055 | public static void main ( final String [ ] args ) throws InjectionException , IOException , ParseException { final Configuration runtimeConfiguration = YarnClientConfiguration . CONF . build ( ) ; runTaskScheduler ( runtimeConfiguration , args ) ; } | Launch the scheduler with YARN client configuration . | 53 | 11 |
43,056 | public static Set < String > getAllClasspathJars ( final String ... excludeEnv ) { final Set < String > jars = new HashSet <> ( ) ; final Set < Path > excludePaths = new HashSet <> ( ) ; for ( final String env : excludeEnv ) { final String path = System . getenv ( env ) ; if ( null != path ) { final File file = new Fil... | Get a set of all classpath entries EXCEPT of those under excludeEnv directories . Every excludeEnv entry is an environment variable name . | 290 | 29 |
43,057 | public synchronized void onPotentiallyIdle ( final IdleMessage reason ) { final DriverStatusManager driverStatusManagerImpl = this . driverStatusManager . get ( ) ; if ( driverStatusManagerImpl . isClosing ( ) ) { LOG . log ( IDLE_REASONS_LEVEL , "Ignoring idle call from [{0}] for reason [{1}]" , new Object [ ] { reaso... | Check whether all Driver components are idle and initiate driver shutdown if they are . | 365 | 15 |
43,058 | public static void serialize ( final File file , final ClassHierarchy classHierarchy ) throws IOException { final ClassHierarchyProto . Node node = serializeNode ( classHierarchy . getNamespace ( ) ) ; try ( final FileOutputStream output = new FileOutputStream ( file ) ) { try ( final DataOutputStream dos = new DataOut... | serialize a class hierarchy into a file . | 96 | 9 |
43,059 | @ Override public Optional < String > trySchedule ( final Tasklet tasklet ) { for ( int i = 0 ; i < idList . size ( ) ; i ++ ) { final int index = ( nextIndex + i ) % idList . size ( ) ; final String workerId = idList . get ( index ) ; if ( idLoadMap . get ( workerId ) < workerCapacity ) { nextIndex = ( index + 1 ) % i... | Checking from nextIndex choose the first worker that fits to schedule the tasklet onto . | 122 | 18 |
43,060 | public static LauncherStatus launchLocal ( final VortexJobConf vortexConf ) { final Configuration runtimeConf = LocalRuntimeConfiguration . CONF . set ( LocalRuntimeConfiguration . MAX_NUMBER_OF_EVALUATORS , MAX_NUMBER_OF_EVALUATORS ) . build ( ) ; return launch ( runtimeConf , vortexConf . getConfiguration ( ) ) ; } | Launch a Vortex job using the local runtime . | 80 | 9 |
43,061 | @ Override public void handle ( final String target , final HttpServletRequest request , final HttpServletResponse response , final int i ) throws IOException , ServletException { LOG . log ( Level . INFO , "JettyHandler handle is entered with target: {0} " , target ) ; final Request baseRequest = ( request instanceof ... | handle http request . | 259 | 4 |
43,062 | private HttpHandler validate ( final HttpServletRequest request , final HttpServletResponse response , final ParsedHttpRequest parsedHttpRequest ) throws IOException , ServletException { final String specification = parsedHttpRequest . getTargetSpecification ( ) ; final String version = parsedHttpRequest . getVersion (... | Validate request and get http handler for the request . | 224 | 11 |
43,063 | private void writeMessage ( final HttpServletResponse response , final String message , final int status ) throws IOException { response . getWriter ( ) . println ( message ) ; response . setStatus ( status ) ; } | process write message and status on the response . | 46 | 9 |
43,064 | final void addHandler ( final HttpHandler handler ) { if ( handler != null ) { if ( ! eventHandlers . containsKey ( handler . getUriSpecification ( ) . toLowerCase ( ) ) ) { eventHandlers . put ( handler . getUriSpecification ( ) . toLowerCase ( ) , handler ) ; } else { LOG . log ( Level . WARNING , "JettyHandler handl... | Add a handler explicitly instead of through injection . This is for handlers created on the fly . | 111 | 18 |
43,065 | public void waitForCompletion ( ) throws Exception { LOG . info ( "Waiting for the Job Driver to complete." ) ; try { synchronized ( this ) { this . wait ( ) ; } } catch ( final InterruptedException ex ) { LOG . log ( Level . WARNING , "Waiting for result interrupted." , ex ) ; } this . reef . close ( ) ; this . contro... | Wait for the job to complete . | 89 | 7 |
43,066 | public < T > EventHandler < RemoteEvent < T > > getHandler ( ) { return new RemoteSenderEventHandler < T > ( encoder , transport , executor ) ; } | Returns a new remote sender event handler . | 39 | 8 |
43,067 | public URI uploadFile ( final String jobFolder , final File file ) throws IOException { LOG . log ( Level . INFO , "Uploading [{0}] to [{1}]" , new Object [ ] { file , jobFolder } ) ; try { final CloudBlobClient cloudBlobClient = this . cloudBlobClientProvider . getCloudBlobClient ( ) ; final CloudBlobContainer contain... | Upload a file to the storage account . | 271 | 8 |
43,068 | private static ConfigurationModule addAll ( final ConfigurationModule conf , final OptionalParameter < String > param , final File folder ) { ConfigurationModule result = conf ; final File [ ] files = folder . listFiles ( ) ; if ( files != null ) { for ( final File f : files ) { if ( f . canRead ( ) && f . exists ( ) &... | 1000 sec . | 108 | 3 |
43,069 | @ Override public int getResubmissionAttempts ( ) { final String containerIdString = YarnUtilities . getContainerIdString ( ) ; final ApplicationAttemptId appAttemptID = YarnUtilities . getAppAttemptId ( containerIdString ) ; if ( containerIdString == null || appAttemptID == null ) { LOG . log ( Level . WARNING , "Was ... | Determines the number of times the Driver has been submitted based on the container ID environment variable provided by YARN . If that fails determine whether the application master is a restart based on the number of previous containers reported by YARN . In the failure scenario returns 1 if restart 0 otherwise . | 264 | 60 |
43,070 | private synchronized void initializeListOfPreviousContainers ( ) { if ( this . previousContainers == null ) { final List < Container > yarnPrevContainers = this . registration . getRegistration ( ) . getContainersFromPreviousAttempts ( ) ; // If it's still null, create an empty list to indicate that it's not a restart.... | Initializes the list of previous containers as reported by YARN . | 153 | 14 |
43,071 | @ Override public void informAboutEvaluatorFailures ( final Set < String > evaluatorIds ) { for ( String evaluatorId : evaluatorIds ) { LOG . log ( Level . WARNING , "Container [" + evaluatorId + "] has failed during driver restart process, FailedEvaluatorHandler will be triggered, but " + "no additional evaluator can ... | Calls the appropriate handler via REEFEventHandlers which is a runtime specific implementation of the YARN runtime . | 187 | 24 |
43,072 | @ Override public void start ( final VortexThreadPool vortexThreadPool ) { final VortexFuture future = vortexThreadPool . submit ( new HelloVortexFunction ( ) , null ) ; try { future . get ( ) ; } catch ( InterruptedException | ExecutionException e ) { throw new RuntimeException ( e ) ; } } | Run the function . | 68 | 4 |
43,073 | public synchronized EvaluatorContext getContext ( final String contextId ) { for ( final EvaluatorContext context : this . contextStack ) { if ( context . getId ( ) . equals ( contextId ) ) { return context ; } } throw new RuntimeException ( "Unknown evaluator context " + contextId ) ; } | Fetch the context with the given ID . | 69 | 9 |
43,074 | public synchronized List < FailedContext > getFailedContextsForEvaluatorFailure ( ) { final List < FailedContext > failedContextList = new ArrayList <> ( ) ; final List < EvaluatorContext > activeContexts = new ArrayList <> ( this . contextStack ) ; Collections . reverse ( activeContexts ) ; for ( final EvaluatorContex... | Create the failed contexts for a FailedEvaluator event . | 115 | 13 |
43,075 | public synchronized void onContextStatusMessages ( final Iterable < ContextStatusPOJO > contextStatusPOJOs , final boolean notifyClientOnNewActiveContext ) { for ( final ContextStatusPOJO contextStatus : contextStatusPOJOs ) { this . onContextStatusMessage ( contextStatus , notifyClientOnNewActiveContext ) ; } } | Process heartbeats from the contexts on an Evaluator . | 71 | 13 |
43,076 | private synchronized void onContextStatusMessage ( final ContextStatusPOJO contextStatus , final boolean notifyClientOnNewActiveContext ) { LOG . log ( Level . FINER , "Processing context status message for context {0}" , contextStatus . getContextId ( ) ) ; switch ( contextStatus . getContextState ( ) ) { case READY :... | Process a heartbeat from a context . | 173 | 7 |
43,077 | private synchronized void onContextReady ( final ContextStatusPOJO contextStatus , final boolean notifyClientOnNewActiveContext ) { assert ContextState . READY == contextStatus . getContextState ( ) ; final String contextID = contextStatus . getContextId ( ) ; // This could be the first message we get from that context... | Process a message with status READY from a context . | 209 | 11 |
43,078 | private synchronized void onNewContext ( final ContextStatusPOJO contextStatus , final boolean notifyClientOnNewActiveContext ) { final String contextID = contextStatus . getContextId ( ) ; LOG . log ( Level . FINE , "Adding new context {0}." , contextID ) ; final Optional < String > parentID = contextStatus . hasParen... | Create and add a new context representer . | 255 | 9 |
43,079 | private synchronized void addContext ( final EvaluatorContext context ) { this . contextStack . add ( context ) ; this . contextIds . add ( context . getId ( ) ) ; } | Add the given context to the data structures . | 41 | 9 |
43,080 | private synchronized void removeContext ( final EvaluatorContext context ) { this . contextStack . remove ( context ) ; this . contextIds . remove ( context . getId ( ) ) ; } | Remove the given context from the data structures . | 41 | 9 |
43,081 | public static void setLoggingLevel ( final Level level ) { final Handler [ ] handlers = Logger . getLogger ( "" ) . getHandlers ( ) ; ConsoleHandler ch = null ; for ( final Handler h : handlers ) { if ( h instanceof ConsoleHandler ) { ch = ( ConsoleHandler ) h ; break ; } } if ( ch == null ) { ch = new ConsoleHandler (... | Sets the logging level . | 128 | 6 |
43,082 | private EvaluatorManager getNewEvaluatorManagerInstance ( final String id , final EvaluatorDescriptor desc ) { LOG . log ( Level . FINEST , "Creating Evaluator Manager for Evaluator ID {0}" , id ) ; final Injector child = this . injector . forkInjector ( ) ; try { child . bindVolatileParameter ( EvaluatorManager . Eval... | Helper method to create a new EvaluatorManager instance . | 223 | 12 |
43,083 | public EvaluatorManager getNewEvaluatorManagerForNewEvaluator ( final ResourceAllocationEvent resourceAllocationEvent ) { final EvaluatorManager evaluatorManager = getNewEvaluatorManagerInstanceForResource ( resourceAllocationEvent ) ; evaluatorManager . fireEvaluatorAllocatedEvent ( ) ; return evaluatorManager ; } | Instantiates a new EvaluatorManager based on a resource allocation . Fires the EvaluatorAllocatedEvent . | 80 | 24 |
43,084 | public EvaluatorManager getNewEvaluatorManagerForEvaluatorFailedDuringDriverRestart ( final ResourceStatusEvent resourceStatusEvent ) { return getNewEvaluatorManagerInstance ( resourceStatusEvent . getIdentifier ( ) , this . evaluatorDescriptorBuilderFactory . newBuilder ( ) . setMemory ( 128 ) . setNumberOfCores ( 1 )... | Instantiates a new EvaluatorManager for a failed evaluator during driver restart . Does not fire an EvaluatorAllocatedEvent . | 125 | 30 |
43,085 | public static String getGraphvizString ( final Configuration config , final boolean showImpl , final boolean showLegend ) { final GraphvizConfigVisitor visitor = new GraphvizConfigVisitor ( config , showImpl , showLegend ) ; final Node root = config . getClassHierarchy ( ) . getNamespace ( ) ; Walk . preorder ( visitor... | Produce a Graphviz DOT string for a given TANG configuration . | 91 | 15 |
43,086 | @ Override public boolean visit ( final ClassNode < ? > node ) { this . graphStr . append ( " " ) . append ( node . getName ( ) ) . append ( " [label=\"" ) . append ( node . getName ( ) ) . append ( "\", shape=box" ) // .append(config.isSingleton(node) ? ", style=filled" : "") . append ( "];\n" ) ; final ClassNode < ? ... | Process current class configuration node . | 352 | 6 |
43,087 | @ Override public boolean visit ( final PackageNode node ) { if ( ! node . getName ( ) . isEmpty ( ) ) { this . graphStr . append ( " " ) . append ( node . getName ( ) ) . append ( " [label=\"" ) . append ( node . getFullName ( ) ) . append ( "\", shape=folder];\n" ) ; } return true ; } | Process current package configuration node . | 88 | 6 |
43,088 | @ Override public boolean visit ( final NamedParameterNode < ? > node ) { this . graphStr . append ( " " ) . append ( node . getName ( ) ) . append ( " [label=\"" ) . append ( node . getSimpleArgName ( ) ) // parameter type, e.g. "Integer" . append ( "\\n" ) . append ( node . getName ( ) ) // short name, e.g. "NumberOf... | Process current configuration node for the named parameter . | 192 | 9 |
43,089 | @ Override public boolean visit ( final Node nodeFrom , final Node nodeTo ) { if ( ! nodeFrom . getName ( ) . isEmpty ( ) ) { this . graphStr . append ( " " ) . append ( nodeFrom . getName ( ) ) . append ( " -> " ) . append ( nodeTo . getName ( ) ) . append ( " [style=solid, dir=back, arrowtail=diamond];\n" ) ; } retur... | Process current edge of the configuration graph . | 103 | 8 |
43,090 | private void init ( final Map < DistributedDataSetPartition , InputSplit [ ] > splitsPerPartition ) { final Pair < InputSplit [ ] , DistributedDataSetPartition [ ] > splitsAndPartitions = getSplitsAndPartitions ( splitsPerPartition ) ; final InputSplit [ ] splits = splitsAndPartitions . getFirst ( ) ; final Distributed... | Initializes the locations of the splits where we d like to be loaded into . Sets all the splits to unallocated | 305 | 24 |
43,091 | protected NumberedSplit < InputSplit > allocateSplit ( final String evaluatorId , final BlockingQueue < NumberedSplit < InputSplit > > value ) { if ( value == null ) { LOG . log ( Level . FINE , "Queue of splits can't be empty. Returning null" ) ; return null ; } while ( true ) { final NumberedSplit < InputSplit > spli... | Allocates the first available split into the evaluator . | 243 | 13 |
43,092 | @ Override public synchronized IdleMessage getIdleStatus ( ) { if ( this . isIdle ( ) ) { return IDLE_MESSAGE ; } final String message = String . format ( "There are %d outstanding container requests and %d allocated containers" , this . outstandingContainerRequests , this . containerAllocationCount ) ; return new Idle... | Driver is idle if regardless of status it has no evaluators allocated and no pending container requests . This method is used in the DriverIdleManager . If all DriverIdlenessSource components are idle DriverIdleManager will initiate Driver shutdown . | 90 | 49 |
43,093 | public static void main ( final String [ ] args ) throws InjectionException { try ( final REEFEnvironment reef = REEFEnvironment . fromConfiguration ( LOCAL_DRIVER_MODULE , DRIVER_CONFIG , ENVIRONMENT_CONFIG ) ) { reef . run ( ) ; final ReefServiceProtos . JobStatusProto status = reef . getLastStatus ( ) ; LOG . log ( ... | Start Hello REEF job with Driver and Client sharing the same process . | 106 | 14 |
43,094 | @ Override public byte [ ] encode ( final RemoteEvent < T > obj ) { if ( obj . getEvent ( ) == null ) { throw new RemoteRuntimeException ( "Event is null" ) ; } final WakeMessagePBuf . Builder builder = WakeMessagePBuf . newBuilder ( ) ; builder . setSeq ( obj . getSeq ( ) ) ; builder . setData ( ByteString . copyFrom ... | Encodes the remote event object to bytes . | 118 | 9 |
43,095 | public static EvaluatorRequest fromString ( final String serializedRequest ) { try { final Decoder decoder = DecoderFactory . get ( ) . jsonDecoder ( AvroEvaluatorRequest . getClassSchema ( ) , serializedRequest ) ; final SpecificDatumReader < AvroEvaluatorRequest > reader = new SpecificDatumReader <> ( AvroEvaluatorRe... | Deserialize EvaluatorRequest . | 135 | 8 |
43,096 | @ Override public Void call ( final Void input ) throws Exception { System . out . println ( "Hello, Vortex!" ) ; return null ; } | Prints to stdout . | 31 | 6 |
43,097 | @ Override public Thread newThread ( final Runnable r ) { final Thread t = new Thread ( this . group , r , String . format ( "%s:thread-%03d" , this . prefix , this . threadNumber . getAndIncrement ( ) ) , 0 ) ; if ( t . isDaemon ( ) ) { t . setDaemon ( false ) ; } if ( t . getPriority ( ) != Thread . NORM_PRIORITY ) {... | Creates a new thread . | 154 | 6 |
43,098 | @ Override public Configuration getConfiguration ( ) { return Tang . Factory . getTang ( ) . newConfigurationBuilder ( ) . bindNamedParameter ( TcpPortRangeBegin . class , String . valueOf ( portRangeBegin ) ) . bindNamedParameter ( TcpPortRangeCount . class , String . valueOf ( portRangeCount ) ) . bindNamedParameter ... | returns a configuration for the class that implements TcpPortProvider so that class can be instantiated . somewhere else | 127 | 23 |
43,099 | public synchronized void onInit ( ) { LOG . entering ( CLASS_NAME , "onInit" ) ; this . clientConnection . send ( this . getInitMessage ( ) ) ; this . setStatus ( DriverStatus . INIT ) ; LOG . exiting ( CLASS_NAME , "onInit" ) ; } | Changes the driver status to INIT and sends message to the client about the transition . | 65 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.