idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
2,200 | public AvroEvaluatorList toAvro ( final Map < String , EvaluatorDescriptor > evaluatorMap , final int totalEvaluators , final String startTime ) { final List < AvroEvaluatorEntry > evaluatorEntities = new ArrayList < > ( ) ; for ( final Map . Entry < String , EvaluatorDescriptor > entry : evaluatorMap . entrySet ( ) ) ... | Build AvroEvaluatorList object . |
2,201 | public T decode ( final byte [ ] data ) { final WakeTuplePBuf tuple ; try { tuple = WakeTuplePBuf . parseFrom ( data ) ; } catch ( final InvalidProtocolBufferException e ) { e . printStackTrace ( ) ; throw new RemoteRuntimeException ( e ) ; } final String className = tuple . getClassName ( ) ; final byte [ ] message = ... | Decodes byte array . |
2,202 | void start ( ) { final ContextStart contextStart = new ContextStartImpl ( this . identifier ) ; for ( final EventHandler < ContextStart > startHandler : this . contextStartHandlers ) { startHandler . onNext ( contextStart ) ; } } | Fires ContextStart to all registered event handlers . |
2,203 | void close ( ) { final ContextStop contextStop = new ContextStopImpl ( this . identifier ) ; for ( final EventHandler < ContextStop > stopHandler : this . contextStopHandlers ) { stopHandler . onNext ( contextStop ) ; } } | Fires ContextStop to all registered event handlers . |
2,204 | public MatMulOutput call ( final MatMulInput input ) throws Exception { final int index = input . getIndex ( ) ; final Matrix < Double > leftMatrix = input . getLeftMatrix ( ) ; final Matrix < Double > rightMatrix = input . getRightMatrix ( ) ; final Matrix < Double > result = leftMatrix . multiply ( rightMatrix ) ; re... | Computes multiplication of two matrices . |
2,205 | public void submitTask ( final String evaluatorConfiguration , final String taskConfiguration ) { final Configuration contextConfiguration = ContextConfiguration . CONF . set ( ContextConfiguration . IDENTIFIER , "RootContext_" + this . getId ( ) ) . build ( ) ; final String contextConfigurationString = this . configur... | Submit Task with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side . |
2,206 | public void submitContext ( final String evaluatorConfiguration , final String contextConfiguration ) { launchWithConfigurationString ( evaluatorConfiguration , contextConfiguration , Optional . < String > empty ( ) , Optional . < String > empty ( ) ) ; } | Submit Context with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side . |
2,207 | public void submitContextAndService ( final String evaluatorConfiguration , final String contextConfiguration , final String serviceConfiguration ) { launchWithConfigurationString ( evaluatorConfiguration , contextConfiguration , Optional . of ( serviceConfiguration ) , Optional . < String > empty ( ) ) ; } | Submit Context and Service with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side . |
2,208 | public void submitContextAndTask ( final String evaluatorConfiguration , final String contextConfiguration , final String taskConfiguration ) { this . launchWithConfigurationString ( evaluatorConfiguration , contextConfiguration , Optional . < String > empty ( ) , Optional . of ( taskConfiguration ) ) ; } | Submit Context and Task with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side . |
2,209 | public void submitContextAndServiceAndTask ( final String evaluatorConfiguration , final String contextConfiguration , final String serviceConfiguration , final String taskConfiguration ) { launchWithConfigurationString ( evaluatorConfiguration , contextConfiguration , Optional . of ( serviceConfiguration ) , Optional ... | Submit Context and Service with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side |
2,210 | private void launchWithConfigurationString ( final String evaluatorConfiguration , final String contextConfiguration , final Optional < String > serviceConfiguration , final Optional < String > taskConfiguration ) { try ( final LoggingScope lb = loggingScopeFactory . evaluatorLaunch ( this . getId ( ) ) ) { final Confi... | Submit Context Service and Task with configuration strings . This method should be called from bridge and the configuration strings are serialized at . Net side |
2,211 | private Configuration makeEvaluatorConfiguration ( final Configuration contextConfiguration , final Optional < Configuration > serviceConfiguration , final Optional < Configuration > taskConfiguration ) { final String contextConfigurationString = this . configurationSerializer . toString ( contextConfiguration ) ; fina... | Make configuration for evaluator . |
2,212 | private Configuration makeEvaluatorConfiguration ( final String contextConfiguration , final Optional < String > evaluatorConfiguration , final Optional < String > serviceConfiguration , final Optional < String > taskConfiguration ) { final ConfigurationModule evaluatorConfigModule ; if ( this . evaluatorManager . getE... | Make configuration for Evaluator . |
2,213 | private Optional < Configuration > makeRootServiceConfiguration ( final Optional < Configuration > serviceConfiguration ) { final EvaluatorType evaluatorType = this . evaluatorManager . getEvaluatorDescriptor ( ) . getProcess ( ) . getType ( ) ; if ( EvaluatorType . CLR == evaluatorType ) { LOG . log ( Level . FINE , "... | Merges the Configurations provided by the evaluatorConfigurationProviders into the given serviceConfiguration if any . |
2,214 | public static < T extends Identifier > List < T > parseList ( final String ids , final IdentifierFactory factory ) { final List < T > result = new ArrayList < > ( ) ; for ( final String token : ids . split ( DELIMITER ) ) { result . add ( ( T ) factory . getNewInstance ( token . trim ( ) ) ) ; } return result ; } | Parse a string of multiple IDs . |
2,215 | public Connection < T > newConnection ( final Identifier destId ) { final Connection < T > connection = connectionMap . get ( destId ) ; if ( connection == null ) { final Connection < T > newConnection = new NetworkConnection < > ( this , destId ) ; connectionMap . putIfAbsent ( destId , newConnection ) ; return connec... | Creates a new connection . |
2,216 | public void start ( ) throws ContextClientCodeException { synchronized ( this . contextStack ) { LOG . log ( Level . FINEST , "Instantiating root context." ) ; this . contextStack . push ( this . launchContext . get ( ) . getRootContext ( ) ) ; if ( this . launchContext . get ( ) . getInitialTaskConfiguration ( ) . isP... | Start the context manager . This initiates the root context . |
2,217 | private void addContext ( final EvaluatorRuntimeProtocol . AddContextProto addContextProto ) throws ContextClientCodeException { synchronized ( this . contextStack ) { try { final ContextRuntime currentTopContext = this . contextStack . peek ( ) ; if ( ! currentTopContext . getIdentifier ( ) . equals ( addContextProto ... | Add a context to the stack . |
2,218 | private void removeContext ( final String contextID ) { synchronized ( this . contextStack ) { if ( ! contextID . equals ( this . contextStack . peek ( ) . getIdentifier ( ) ) ) { throw new IllegalStateException ( "Trying to close context with id `" + contextID + "`. But the top context has id `" + this . contextStack ... | Remove the context with the given ID from the stack . |
2,219 | private void startTask ( final EvaluatorRuntimeProtocol . StartTaskProto startTaskProto ) throws TaskClientCodeException { synchronized ( this . contextStack ) { final ContextRuntime currentActiveContext = this . contextStack . peek ( ) ; final String expectedContextId = startTaskProto . getContextId ( ) ; if ( ! expec... | Launch a Task . |
2,220 | public void mark ( final long n ) { tickIfNecessary ( ) ; count . addAndGet ( n ) ; m1Thp . update ( n ) ; m5Thp . update ( n ) ; m15Thp . update ( n ) ; } | Marks the number of events . |
2,221 | public double getMeanThp ( ) { if ( getCount ( ) == 0 ) { return 0.0 ; } else { final double elapsed = getTick ( ) - startTime ; return getCount ( ) / elapsed * TimeUnit . SECONDS . toNanos ( 1 ) ; } } | Gets the mean throughput . |
2,222 | private Optional < String > getPreferredNode ( final List < String > nodeNames ) { for ( final String nodeName : nodeNames ) { final String possibleRack = this . racksPerNode . get ( nodeName ) ; if ( possibleRack != null && this . freeNodesPerRack . get ( possibleRack ) . containsKey ( nodeName ) ) { return Optional .... | Returns the node name of the container to be allocated if it s available selected from the list of preferred node names . If the list is empty then an empty optional is returned . |
2,223 | Optional < Container > allocateContainer ( final ResourceRequestEvent requestEvent ) { Container container = null ; final Optional < String > nodeName = getPreferredNode ( requestEvent . getNodeNameList ( ) ) ; if ( nodeName . isPresent ( ) ) { container = allocateBasedOnNode ( requestEvent . getMemorySize ( ) . orElse... | Allocates a container based on a request event . First it tries to match a given node if it cannot it tries to get a spot in a rack . |
2,224 | private < TEvent > void unimplemented ( final long identifier , final TEvent event ) { LOG . log ( Level . SEVERE , "Unimplemented event: [{0}]: {1}" , new Object [ ] { identifier , event } ) ; throw new RuntimeException ( "Event not supported: " + event ) ; } | Called when an event is received that does not have an onNext method definition in TSubCls . Override in TSubClas to handle the error . |
2,225 | public < TEvent > void onNext ( final long identifier , final TEvent event ) throws IllegalAccessException , InvocationTargetException { final Method onNext = methodMap . get ( event . getClass ( ) . getName ( ) ) ; if ( onNext != null ) { onNext . invoke ( this , identifier , event ) ; } else { unimplemented ( identif... | Generic event onNext method in the base interface which maps the call to a concrete event onNext method in TSubCls if one exists otherwise unimplemented is invoked . |
2,226 | public void run ( ) { this . stateLock . lock ( ) ; try { if ( this . state != RunnableProcessState . INIT ) { throw new IllegalStateException ( "The RunnableProcess can't be reused" ) ; } final File errFile = new File ( folder , standardErrorFileName ) ; final File outFile = new File ( folder , standardOutFileName ) ;... | Runs the configured process . |
2,227 | public void cancel ( ) { this . stateLock . lock ( ) ; try { if ( this . state == RunnableProcessState . RUNNING ) { this . process . destroy ( ) ; if ( ! this . doneCond . await ( DESTROY_WAIT_TIME , TimeUnit . MILLISECONDS ) ) { LOG . log ( Level . FINE , "{0} milliseconds elapsed" , DESTROY_WAIT_TIME ) ; } } if ( th... | Cancels the running process if it is running . |
2,228 | private void setState ( final RunnableProcessState newState ) { if ( ! this . state . isLegal ( newState ) ) { throw new IllegalStateException ( "Transition from " + this . state + " to " + newState + " is illegal" ) ; } this . state = newState ; } | Sets a new state for the process . |
2,229 | public void close ( ) { LOG . log ( Level . FINER , "Closing the evaluators - begin" ) ; final List < EvaluatorManager > evaluatorsCopy ; synchronized ( this ) { evaluatorsCopy = new ArrayList < > ( this . evaluators . values ( ) ) ; } for ( final EvaluatorManager evaluatorManager : evaluatorsCopy ) { if ( ! evaluatorM... | Closes all EvaluatorManager instances managed . |
2,230 | public synchronized void put ( final EvaluatorManager evaluatorManager ) { final String evaluatorId = evaluatorManager . getId ( ) ; if ( this . wasClosed ( evaluatorId ) ) { throw new IllegalArgumentException ( "Trying to re-add an Evaluator that has already been closed: " + evaluatorId ) ; } final EvaluatorManager pr... | Adds an EvaluatorManager . |
2,231 | public synchronized void removeClosedEvaluator ( final EvaluatorManager evaluatorManager ) { final String evaluatorId = evaluatorManager . getId ( ) ; LOG . log ( Level . FINE , "Removing closed evaluator: {0}" , evaluatorId ) ; if ( ! evaluatorManager . isClosed ( ) ) { throw new IllegalArgumentException ( "Removing e... | Moves evaluator from map of active evaluators to set of closed evaluators . |
2,232 | public void submit ( final File clrFolder , final boolean submitDriver , final boolean local , final Configuration clientConfig ) { try ( final LoggingScope ls = this . loggingScopeFactory . driverSubmit ( submitDriver ) ) { if ( ! local ) { this . driverConfiguration = Configurations . merge ( this . driverConfigurati... | Launch the job driver . |
2,233 | @ SuppressWarnings ( "checkstyle:hiddenfield" ) public void setDriverInfo ( final String identifier , final int memory , final String jobSubmissionDirectory ) { if ( identifier == null || identifier . isEmpty ( ) ) { throw new RuntimeException ( "driver id cannot be null or empty" ) ; } if ( memory <= 0 ) { throw new R... | Set the driver memory . |
2,234 | public void waitForCompletion ( final int waitTime ) { LOG . info ( "Waiting for the Job Driver to complete: " + waitTime ) ; if ( waitTime == 0 ) { close ( 0 ) ; return ; } else if ( waitTime < 0 ) { waitTillDone ( ) ; } final long endTime = System . currentTimeMillis ( ) + waitTime * 1000 ; close ( endTime ) ; } | Wait for the job driver to complete . |
2,235 | public boolean cancel ( final boolean mayInterruptIfRunning ) { try { return cancel ( mayInterruptIfRunning , Optional . < Long > empty ( ) , Optional . < TimeUnit > empty ( ) ) ; } catch ( final TimeoutException e ) { LOG . log ( Level . WARNING , "Received a TimeoutException in VortexFuture.cancel(). Should not have ... | Sends a cancel signal and blocks and waits until the task is cancelled completed or failed . |
2,236 | public boolean cancel ( final boolean mayInterruptIfRunning , final long timeout , final TimeUnit unit ) throws TimeoutException { return cancel ( mayInterruptIfRunning , Optional . of ( timeout ) , Optional . of ( unit ) ) ; } | Sends a cancel signal and blocks and waits until the task is cancelled completed or failed or if the timeout has expired . |
2,237 | public TOutput get ( ) throws InterruptedException , ExecutionException , CancellationException { countDownLatch . await ( ) ; if ( userResult != null ) { return userResult . get ( ) ; } else { assert this . cancelled . get ( ) || userException != null ; if ( userException != null ) { throw new ExecutionException ( use... | Infinitely wait for the result of the task . |
2,238 | public TOutput get ( final long timeout , final TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException , CancellationException { if ( ! countDownLatch . await ( timeout , unit ) ) { throw new TimeoutException ( "Waiting for the results of the task timed out. Timeout = " + timeout + " in tim... | Wait a certain period of time for the result of the task . |
2,239 | public void completed ( final int pTaskletId , final TOutput result ) { assert taskletId == pTaskletId ; this . userResult = Optional . ofNullable ( result ) ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { public void run ( ) { callbackHandler . onSuccess ( userResult . get ( ) ) ; } } ) ; } ... | Called by VortexMaster to let the user know that the Tasklet completed . |
2,240 | public void threwException ( final int pTaskletId , final Exception exception ) { assert taskletId == pTaskletId ; this . userException = exception ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { public void run ( ) { callbackHandler . onFailure ( exception ) ; } } ) ; } this . countDownLatch... | Called by VortexMaster to let the user know that the Tasklet threw an exception . |
2,241 | public void cancelled ( final int pTaskletId ) { assert taskletId == pTaskletId ; this . cancelled . set ( true ) ; if ( callbackHandler != null ) { executor . execute ( new Runnable ( ) { public void run ( ) { callbackHandler . onFailure ( new InterruptedException ( "VortexFuture has been cancelled on request." ) ) ; ... | Called by VortexMaster to let the user know that the Tasklet was cancelled . |
2,242 | private Resource getResource ( final JobSubmissionEvent jobSubmissionEvent ) { return new Resource ( ) . setMemory ( jobSubmissionEvent . getDriverMemory ( ) . get ( ) ) . setvCores ( jobSubmissionEvent . getDriverCPUCores ( ) . get ( ) ) ; } | Extracts the resource demands from the jobSubmissionEvent . |
2,243 | private List < String > getCommandList ( final JobSubmissionEvent jobSubmissionEvent ) { return new JavaLaunchCommandBuilder ( ) . setJavaPath ( "%JAVA_HOME%/bin/java" ) . setConfigurationFilePaths ( Collections . singletonList ( this . filenames . getDriverConfigurationPath ( ) ) ) . setClassPath ( this . classpath . ... | Assembles the command to execute the Driver in list form . |
2,244 | public void run ( ) { while ( ! this . closed ) { final EventSource < T > nextSource = sources . poll ( ) ; if ( null != nextSource ) { final T message = nextSource . getNext ( ) ; if ( null != message ) { sources . add ( nextSource ) ; this . output . onNext ( message ) ; } else { Logger . getLogger ( Pull2Push . clas... | Executes the message loop . |
2,245 | public CommunicationGroupDriver getNewInstance ( final Class < ? extends Name < String > > groupName , final Class < ? extends Topology > topologyClass , final int numberOfTasks , final int customFanOut ) throws InjectionException { final Injector newInjector = injector . forkInjector ( ) ; newInjector . bindVolatilePa... | Instantiates a new CommunicationGroupDriver instance . |
2,246 | public byte [ ] call ( final byte [ ] memento ) throws IOException { try ( final DataOutputStream outputStream = outputStreamProvider . create ( "hello" ) ) { outputStream . writeBytes ( "Hello REEF!" ) ; } return null ; } | Receives an output stream from the output service and writes Hello REEF! on it . |
2,247 | public static void main ( final String [ ] args ) { try { final Configuration config = getClientConfiguration ( args ) ; LOG . log ( Level . INFO , "Configuration:\n--\n{0}--" , Configurations . toString ( config , true ) ) ; final Injector injector = Tang . Factory . getTang ( ) . newInjector ( config ) ; final Suspen... | Main method that runs the example . |
2,248 | public String getTrackingUrl ( ) { if ( this . httpServer == null ) { return "" ; } try { return InetAddress . getLocalHost ( ) . getHostAddress ( ) + ":" + httpServer . getPort ( ) ; } catch ( final UnknownHostException e ) { LOG . log ( Level . WARNING , "Cannot get host address." , e ) ; throw new RuntimeException (... | get tracking URI . |
2,249 | private void kill ( final String applicationId ) throws IOException { LOG . log ( Level . INFO , "Killing application [{0}]" , applicationId ) ; this . hdInsightInstance . killApplication ( applicationId ) ; } | Kills the application with the given id . |
2,250 | private void logs ( final String applicationId ) throws IOException { LOG . log ( Level . INFO , "Fetching logs for application [{0}]" , applicationId ) ; this . logFetcher . fetch ( applicationId , new OutputStreamWriter ( System . out , StandardCharsets . UTF_8 ) ) ; } | Fetches the logs for the application with the given id and prints them to System . out . |
2,251 | private void logs ( final String applicationId , final File folder ) throws IOException { LOG . log ( Level . FINE , "Fetching logs for application [{0}] and storing them in folder [{1}]" , new Object [ ] { applicationId , folder . getAbsolutePath ( ) } ) ; if ( ! folder . exists ( ) && ! folder . mkdirs ( ) ) { LOG . ... | Fetches the logs for the application with the given id and stores them in the given folder . One file per container . |
2,252 | private void list ( ) throws IOException { LOG . log ( Level . FINE , "Listing applications" ) ; final List < ApplicationState > applications = this . hdInsightInstance . listApplications ( ) ; for ( final ApplicationState appState : applications ) { if ( appState . getState ( ) . equals ( "RUNNING" ) ) { System . out ... | Fetches a list of all running applications . |
2,253 | public byte [ ] toBytes ( final DefinedRuntimes definedRuntimes ) { final DatumWriter < DefinedRuntimes > configurationWriter = new SpecificDatumWriter < > ( DefinedRuntimes . class ) ; try ( final ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ) { final BinaryEncoder binaryEncoder = EncoderFactory . get ( )... | Serializes DefinedRuntimes . |
2,254 | private static boolean couldBeYarnConfigurationPath ( final String path ) { return path . contains ( "conf" ) || path . contains ( "etc" ) || path . contains ( HadoopEnvironment . HADOOP_CONF_DIR ) ; } | The oracle that tells us whether a given path could be a YARN configuration path . |
2,255 | public static String parseIp ( final String remoteIdentifier ) { return remoteIdentifier . substring ( PROTOCOL . length ( ) , remoteIdentifier . lastIndexOf ( ':' ) ) ; } | Get the IP address from the remote identifier . |
2,256 | public void onNext ( final JobSubmissionEvent jobSubmissionEvent ) { LOG . log ( Level . FINEST , "Submitting job: {0}" , jobSubmissionEvent ) ; try { this . applicationId = createApplicationId ( jobSubmissionEvent ) ; final String folderName = this . azureBatchFileNames . getStorageJobFolder ( this . applicationId ) ;... | Invoked when JobSubmissionEvent is triggered . |
2,257 | public static void main ( final String [ ] args ) throws InjectionException , IOException { final JavaConfigurationBuilder driverConfigBuilder = TANG . newConfigurationBuilder ( STATIC_DRIVER_CONFIG ) ; new CommandLine ( driverConfigBuilder ) . registerShortNameOfClass ( Command . class ) . registerShortNameOfClass ( N... | Start the distributed shell job . |
2,258 | synchronized void add ( final Container container ) { final String containerId = container . getId ( ) . toString ( ) ; if ( this . hasContainer ( containerId ) ) { throw new RuntimeException ( "Trying to add a Container that is already known: " + containerId ) ; } this . containers . put ( containerId , container ) ; ... | Registers the given container . |
2,259 | synchronized Container removeAndGet ( final String containerId ) { final Container result = this . containers . remove ( containerId ) ; if ( null == result ) { throw new RuntimeException ( "Unknown container to remove: " + containerId ) ; } return result ; } | Removes the container with the given ID . |
2,260 | public static void main ( final String [ ] args ) throws Exception { LOG . log ( Level . INFO , "Entering EvaluatorShimLauncher.main()." ) ; final Injector injector = Tang . Factory . getTang ( ) . newInjector ( parseCommandLine ( args ) ) ; final EvaluatorShimLauncher launcher = injector . getInstance ( EvaluatorShimL... | The starting point of the evaluator shim launcher . |
2,261 | public void onNext ( final RemoteEvent < T > value ) { try { LOG . log ( Level . FINEST , "Link: {0} event: {1}" , new Object [ ] { linkRef , value } ) ; if ( linkRef . get ( ) == null ) { queue . add ( value ) ; final Link < byte [ ] > link = transport . get ( value . remoteAddress ( ) ) ; if ( link != null ) { LOG . ... | Handles the event to send to a remote node . |
2,262 | public byte [ ] recvFromChildren ( ) { LOG . entering ( "OperatorTopologyStructImpl" , "recvFromChildren" , getQualifiedName ( ) ) ; for ( final NodeStruct child : children ) { childrenToRcvFrom . add ( child . getId ( ) ) ; } byte [ ] retVal = new byte [ 0 ] ; while ( ! childrenToRcvFrom . isEmpty ( ) ) { LOG . finest... | Receive data from all children as a single byte array . Messages from children are simply byte - concatenated . This method is currently used only by the Gather operator . |
2,263 | public MultiRuntimeConfigurationBuilder addRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_RUNTIMES . contains ( runtimeName ) , "unsupported runtime " + runtimeName ) ; this . runtimeNames . add ( runtimeName ) ; return this ; } | Adds runtime name to the builder . |
2,264 | public MultiRuntimeConfigurationBuilder setDefaultRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_RUNTIMES . contains ( runtimeName ) , "Unsupported runtime " + runtimeName ) ; Validate . isTrue ( ! this . defaultRuntime . isPresent ( ) , "Default runtime was already added" ) ; this . defaultRuntim... | Sets default runtime . Default runtime is used when no runtime was specified for evaluator |
2,265 | public MultiRuntimeConfigurationBuilder setSubmissionRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_SUBMISSION_RUNTIMES . contains ( runtimeName ) , "Unsupported submission runtime " + runtimeName ) ; Validate . isTrue ( this . submissionRuntime == null , "Submission runtime was already added" ) ;... | Sets the submission runtime . Submission runtime is used for launching the job driver . |
2,266 | public Configuration build ( ) { Validate . notNull ( this . submissionRuntime , "Default Runtime was not defined" ) ; if ( ! this . defaultRuntime . isPresent ( ) || this . runtimeNames . size ( ) == 1 ) { this . defaultRuntime = Optional . of ( this . runtimeNames . toArray ( new String [ 0 ] ) [ 0 ] ) ; } Validate .... | Builds the configuration . |
2,267 | @ SuppressWarnings ( "unchecked" ) public < T > T parseDefaultValue ( final NamedParameterNode < T > name ) { final String [ ] vals = name . getDefaultInstanceAsStrings ( ) ; final T [ ] ret = ( T [ ] ) new Object [ vals . length ] ; for ( int i = 0 ; i < vals . length ; i ++ ) { final String val = vals [ i ] ; try { r... | A helper method that returns the parsed default value of a given NamedParameter . |
2,268 | public Class < ? > classForName ( final String name ) throws ClassNotFoundException { return ReflectionUtilities . classForName ( name , loader ) ; } | Helper method that converts a String to a Class using this ClassHierarchy s classloader . |
2,269 | @ SuppressWarnings ( "unchecked" ) private < T > Node registerClass ( final Class < T > c ) throws ClassHierarchyException { if ( c . isArray ( ) ) { throw new UnsupportedOperationException ( "Can't register array types" ) ; } try { return getAlreadyBoundNode ( c ) ; } catch ( final NameResolutionException ignored ) { ... | Assumes that all of the parents of c have been registered already . |
2,270 | private static void logToken ( final Level logLevel , final String msgPrefix , final UserGroupInformation user ) { if ( LOG . isLoggable ( logLevel ) ) { LOG . log ( logLevel , "{0} number of tokens: [{1}]." , new Object [ ] { msgPrefix , user . getCredentials ( ) . numberOfTokens ( ) } ) ; for ( final org . apache . h... | Log all the tokens in the container for thr user . |
2,271 | private void writeDriverHttpEndPoint ( final File driverFolder , final String applicationId , final Path dfsPath ) throws IOException { final FileSystem fs = FileSystem . get ( yarnConfiguration ) ; final Path httpEndpointPath = new Path ( dfsPath , fileNames . getDriverHttpEndpoint ( ) ) ; String trackingUri = null ; ... | We leave a file behind in job submission directory so that clr client can figure out the applicationId and yarn rest endpoint . |
2,272 | public void start ( final VortexThreadPool vortexThreadPool ) { final Vector < Integer > inputVector = new Vector < > ( ) ; for ( int i = 0 ; i < dimension ; i ++ ) { inputVector . add ( i ) ; } final List < VortexFuture < Integer > > futures = new ArrayList < > ( ) ; final AddOneFunction addOneFunction = new AddOneFun... | Perform a simple vector calculation on Vortex . |
2,273 | public static int getTotalPhysicalMemorySizeInMB ( ) { int memorySizeInMB ; try { long memorySizeInBytes = ( ( com . sun . management . OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ( ) ) . getTotalPhysicalMemorySize ( ) ; memorySizeInMB = ( int ) ( memorySizeInBytes / BYTES_IN_MEGABYTE ) ; } cat... | Returns the total amount of physical memory on the current machine in megabytes . |
2,274 | public void submitContextAndTaskString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String taskConfigurationString ) { final DateFormat dateFormat = new SimpleDateFormat ( "yyyy/MM/dd HH:mm:ss" ) ; LOG . log ( Level . FINE , "AllocatedEvaluatorBridge:submitContextAndTask... | Bridge function for REEF . NET to submit context and task configurations for the allocated evaluator . |
2,275 | public void submitContextString ( final String evaluatorConfigurationString , final String contextConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorConfigurationString provided." ) ; } if ( contextConfigurationString . isEmpty ( ) ) { throw new Runt... | Bridge function for REEF . NET to submit context configuration for the allocated evaluator . |
2,276 | public void submitContextAndServiceString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String serviceConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorConfigurationString provided." ) ; } if ( context... | Bridge function for REEF . NET to submit context and service configurations for the allocated evaluator . |
2,277 | public void submitContextAndServiceAndTaskString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String serviceConfigurationString , final String taskConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorCon... | Bridge function for REEF . NET to submit context service . and task configurations for the allocated evaluator . |
2,278 | public String getEvaluatorDescriptorString ( ) { final String descriptorString = Utilities . getEvaluatorDescriptorString ( jallocatedEvaluator . getEvaluatorDescriptor ( ) ) ; LOG . log ( Level . INFO , "allocated evaluator - serialized evaluator descriptor: " + descriptorString ) ; return descriptorString ; } | Gets the serialized evaluator descriptor from the Java allocated evaluator . |
2,279 | public static String getGraphvizString ( final InjectionPlan < ? > injectionPlan , final boolean showLegend ) { final GraphvizInjectionPlanVisitor visitor = new GraphvizInjectionPlanVisitor ( showLegend ) ; Walk . preorder ( visitor , visitor , injectionPlan ) ; return visitor . toString ( ) ; } | Produce a Graphviz DOT string for a given TANG injection plan . |
2,280 | public boolean visit ( final Constructor < ? > node ) { this . graphStr . append ( " \"" ) . append ( node . getClass ( ) ) . append ( '_' ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\" [label=\"" ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\", shape=box];\n" ) ; return true ; } | Process current injection plan node of Constructor type . |
2,281 | public boolean visit ( final JavaInstance < ? > node ) { this . graphStr . append ( " \"" ) . append ( node . getClass ( ) ) . append ( '_' ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\" [label=\"" ) . append ( node . getNode ( ) . getName ( ) ) . append ( " = " ) . append ( node . getInstanceAsString ... | Process current injection plan node of JavaInstance type . |
2,282 | public boolean visit ( final InjectionPlan < ? > nodeFrom , final InjectionPlan < ? > nodeTo ) { this . graphStr . append ( " \"" ) . append ( nodeFrom . getClass ( ) ) . append ( '_' ) . append ( nodeFrom . getNode ( ) . getName ( ) ) . append ( "\" -> \"" ) . append ( nodeTo . getClass ( ) ) . append ( '_' ) . appen... | Process current edge of the injection plan . |
2,283 | public static void main ( final String [ ] args ) { LOG . log ( Level . INFO , "Entering Launch at :::" + new Date ( ) ) ; try { if ( args == null || args . length == 0 ) { throw new IllegalArgumentException ( "No arguments provided, at least a clrFolder should be supplied." ) ; } final File dotNetFolder = new File ( a... | Main method that starts the CLR Bridge from Java . |
2,284 | public static String getIdentifier ( final Configuration c ) { try { return Tang . Factory . getTang ( ) . newInjector ( c ) . getNamedInstance ( ContextIdentifier . class ) ; } catch ( final InjectionException e ) { throw new RuntimeException ( "Unable to determine context identifier. Giving up." , e ) ; } } | Extracts a context id from the given configuration . |
2,285 | private void log ( final String message ) { if ( this . optionalParams . isPresent ( ) ) { logger . log ( logLevel , message , params ) ; } else { logger . log ( logLevel , message ) ; } } | Log message . |
2,286 | String getWhereTaskletWasScheduledTo ( final int taskletId ) { for ( final Map . Entry < String , VortexWorkerManager > entry : runningWorkers . entrySet ( ) ) { final String workerId = entry . getKey ( ) ; final VortexWorkerManager vortexWorkerManager = entry . getValue ( ) ; if ( vortexWorkerManager . containsTasklet... | Find where a tasklet is scheduled to . |
2,287 | public static void logThreads ( final Logger logger , final Level level , final String prefix , final String threadPrefix , final String stackElementPrefix ) { if ( logger . isLoggable ( level ) ) { logger . log ( level , getFormattedThreadList ( prefix , threadPrefix , stackElementPrefix ) ) ; } } | Logs the currently active threads and their stack trace to the given Logger and Level . |
2,288 | public static String getFormattedThreadList ( final String prefix , final String threadPrefix , final String stackElementPrefix ) { final TreeMap < String , StackTraceElement [ ] > threadNames = new TreeMap < > ( ) ; for ( final Map . Entry < Thread , StackTraceElement [ ] > entry : Thread . getAllStackTraces ( ) . ent... | Produces a String representation of the currently running threads . |
2,289 | public static String getFormattedDeadlockInfo ( final String prefix , final String threadPrefix , final String stackElementPrefix ) { final StringBuilder message = new StringBuilder ( prefix ) ; final DeadlockInfo deadlockInfo = new DeadlockInfo ( ) ; final ThreadInfo [ ] deadlockedThreads = deadlockInfo . getDeadlocke... | Produces a String representation of threads that are deadlocked including lock information . |
2,290 | void parseOneFile ( final Path inputPath , final Writer outputWriter ) throws IOException { try ( final TFile . Reader . Scanner scanner = this . getScanner ( inputPath ) ) { while ( ! scanner . atEnd ( ) ) { new LogFileEntry ( scanner . entry ( ) ) . write ( outputWriter ) ; scanner . advance ( ) ; } } } | Parses the given file and writes its contents into the outputWriter for all logs in it . |
2,291 | void parseOneFile ( final Path inputPath , final File outputFolder ) throws IOException { try ( final TFile . Reader . Scanner scanner = this . getScanner ( inputPath ) ) { while ( ! scanner . atEnd ( ) ) { new LogFileEntry ( scanner . entry ( ) ) . write ( outputFolder ) ; scanner . advance ( ) ; } } } | Parses the given file and stores the logs for each container in a file named after the container in the given . outputFolder |
2,292 | public byte [ ] encode ( final NSMessage < T > obj ) { if ( isStreamingCodec ) { final StreamingCodec < T > streamingCodec = ( StreamingCodec < T > ) codec ; try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { try ( DataOutputStream daos = new DataOutputStream ( baos ) ) { daos . writeUTF ( obj . getSr... | Encodes a network service message to bytes . |
2,293 | public NSMessage < T > decode ( final byte [ ] buf ) { if ( isStreamingCodec ) { final StreamingCodec < T > streamingCodec = ( StreamingCodec < T > ) codec ; try ( ByteArrayInputStream bais = new ByteArrayInputStream ( buf ) ) { try ( DataInputStream dais = new DataInputStream ( bais ) ) { final Identifier srcId = fact... | Decodes a network service message from bytes . |
2,294 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void beforeTaskStart ( ) throws TaskStartHandlerFailure { LOG . log ( Level . FINEST , "Sending TaskStart event to the registered event handlers." ) ; for ( final EventHandler < TaskStart > startHandler : this . taskStartHandlers ) { try { startHandler . onNext ( ... | Sends the TaskStart event to the handlers for it . |
2,295 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void afterTaskExit ( ) throws TaskStopHandlerFailure { LOG . log ( Level . FINEST , "Sending TaskStop event to the registered event handlers." ) ; for ( final EventHandler < TaskStop > stopHandler : this . taskStopHandlers ) { try { stopHandler . onNext ( this . t... | Sends the TaskStop event to the handlers for it . |
2,296 | public void write ( final T message ) { LOG . log ( Level . FINEST , "write {0} :: {1}" , new Object [ ] { channel , message } ) ; final ChannelFuture future = channel . writeAndFlush ( Unpooled . wrappedBuffer ( encoder . encode ( message ) ) ) ; if ( listener != null ) { future . addListener ( new NettyChannelFutureL... | Writes the message to this link . |
2,297 | private static Configuration readConfigurationFromDisk ( final String configPath , final ConfigurationSerializer serializer ) { LOG . log ( Level . FINER , "Loading configuration file: {0}" , configPath ) ; final File evaluatorConfigFile = new File ( configPath ) ; if ( ! evaluatorConfigFile . exists ( ) ) { throw fata... | Read configuration from a given file and deserialize it into Tang configuration object that can be used for injection . Configuration is currently serialized using Avro . This method also prints full deserialized configuration into log . |
2,298 | synchronized ResourceRequestEvent satisfyOne ( ) { final ResourceRequest req = this . requestQueue . element ( ) ; req . satisfyOne ( ) ; if ( req . isSatisfied ( ) ) { this . requestQueue . poll ( ) ; } return req . getRequestProto ( ) ; } | Satisfies one resource for the front - most request . If that satisfies the request it is removed from the queue . |
2,299 | public void serialize ( final ByteArrayOutputStream outputStream , final SpecificRecord message , final long sequence ) throws IOException { final BinaryEncoder encoder = EncoderFactory . get ( ) . binaryEncoder ( outputStream , null ) ; headerWriter . write ( new Header ( sequence , msgMetaClassName ) , encoder ) ; me... | Deserialize messages of type TMessage from input outputStream . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.