Example #1
0
 public void OnNext(IAllocatedEvaluator value)
 {
     value.SubmitContext(Common.Context.ContextConfiguration.ConfigurationModule
                         .Set(Common.Context.ContextConfiguration.Identifier, ContextOneId)
                         .Build());
     _evaluator = value;
 }
Example #2
0
 public void OnNext(IAllocatedEvaluator value)
 {
     value.SubmitContext(
         ContextConfiguration.ConfigurationModule
         .Set(ContextConfiguration.Identifier, "ContextID" + _contextNumber++)
         .Build());
 }
            /// <summary>
            /// Submits two contexts, one that fails the Evaluator and another that allows for
            /// Context Stacking.
            /// </summary>
            public void OnNext(IAllocatedEvaluator value)
            {
                lock (_lock)
                {
                    if (_shouldFailOnRootContext)
                    {
                        // Failing config.
                        var ctxConf = ContextConfiguration.ConfigurationModule
                                      .Set(ContextConfiguration.Identifier, Context0)
                                      .Build();

                        var serviceConf = ServiceConfiguration.ConfigurationModule
                                          .Set(ServiceConfiguration.Services, GenericType <ServiceConstructorExceptionService> .Class)
                                          .Build();

                        value.SubmitContextAndService(ctxConf, serviceConf);
                        _shouldFailOnRootContext = false;
                    }
                    else
                    {
                        // Context stacking config.
                        value.SubmitContext(
                            ContextConfiguration.ConfigurationModule
                            .Set(ContextConfiguration.Identifier, Context1)
                            .Build());
                    }
                }
            }
Example #4
0
 public void OnNext(IAllocatedEvaluator value)
 {
     value.SubmitContext(
         ContextConfiguration.ConfigurationModule
         .Set(ContextConfiguration.Identifier, "ContextID")
         .Set(ContextConfiguration.OnContextStart, GenericType <ContextStart> .Class)
         .Build());
 }
Example #5
0
 public void OnNext(IAllocatedEvaluator value)
 {
     Logger.Log(Level.Info, "AllocatedEvaluator: " + value.Id);
     value.SubmitContext(
         ContextConfiguration.ConfigurationModule
         .Set(ContextConfiguration.Identifier, ContextId + Interlocked.Increment(ref _contextNumber))
         .Build());
 }
Example #6
0
            public void OnNext(IAllocatedEvaluator value)
            {
                var contextConfig = ContextConfiguration.ConfigurationModule
                                    .Set(ContextConfiguration.Identifier, ContextId)
                                    .Set(ContextConfiguration.OnMessage, GenericType <ReceiveContextMessageExceptionHandler> .Class)
                                    .Build();

                value.SubmitContext(contextConfig);
            }
 public void OnNext(IAllocatedEvaluator value)
 {
     lock (_lock)
     {
         if (_shouldSubmitFailEvaluatorContext)
         {
             value.SubmitContext(
                 GetContextStartExceptionContextConfiguration(FailEvaluatorContextId));
             _shouldSubmitFailEvaluatorContext = false;
         }
         else
         {
             value.SubmitContext(
                 ContextConfiguration.ConfigurationModule
                 .Set(ContextConfiguration.Identifier, ContextId0)
                 .Build());
         }
     }
 }
Example #8
0
 public void OnNext(IAllocatedEvaluator value)
 {
     lock (_lock)
     {
         value.SubmitContext(
             ContextConfiguration.ConfigurationModule
             .Set(ContextConfiguration.Identifier, ContextId + _contextNumber)
             .Build());
         _contextNumber++;
     }
 }
 public void OnNext(IAllocatedEvaluator value)
 {
     lock (_lock)
     {
         if (_shouldSubmitFailEvaluatorContext)
         {
             // This context should fail the Evaluator upon calling ActiveContext.Dispose().
             value.SubmitContext(
                 GetContextStopExceptionContextConfiguration(FailEvaluatorContextId));
             _shouldSubmitFailEvaluatorContext = false;
         }
         else
         {
             // This is the Context that will be stacked upon by ContextId1.
             value.SubmitContext(
                 ContextConfiguration.ConfigurationModule
                 .Set(ContextConfiguration.Identifier, ContextId0)
                 .Build());
         }
     }
 }
Example #10
0
        public void OnNext(IAllocatedEvaluator allocatedEvaluator)
        {
            string taskId = "Task_" + allocatedEvaluator.Id;
            using (LOGGER.LogFunction("HelloSimpleEventHandlers::allocatedEvaluator received {0}.", taskId))
            {
                _allocatedEvaluator = allocatedEvaluator;

                IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule.Set(ContextConfiguration.Identifier, "HelloSimpleEventHandlersContext_" + Guid.NewGuid().ToString("N")).Build();

                allocatedEvaluator.SubmitContext(contextConfiguration);
            }
        }
Example #11
0
        public void OnNext(IAllocatedEvaluator allocatedEvaluator)
        {
            string taskId     = "Task_" + allocatedEvaluator.Id;
            var    descriptor = allocatedEvaluator.GetEvaluatorDescriptor();

            Logger.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Evaluator is assigned with {0} MB of memory and {1} cores.", descriptor.Memory, descriptor.VirtualCore));

            using (Logger.LogFunction("HelloSimpleEventHandlers::allocatedEvaluator received {0}.", taskId))
            {
                IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule.Set(ContextConfiguration.Identifier, "HelloSimpleEventHandlersContext_" + Guid.NewGuid().ToString("N")).Build();
                allocatedEvaluator.SubmitContext(contextConfiguration);
            }
        }
            public override void OnNext(IAllocatedEvaluator value)
            {
                var contextConfig = ContextConfiguration.ConfigurationModule
                                    .Set(ContextConfiguration.Identifier, ContextId)
                                    .Set(ContextConfiguration.OnContextStart, GenericType <PoisonedEventHandler <IContextStart> > .Class)
                                    .Build();

                var poisonConfig = TangFactory.GetTang().NewConfigurationBuilder()
                                   .BindIntNamedParam <CrashTimeout>("0")
                                   .BindIntNamedParam <CrashMinDelay>("0")
                                   .BindNamedParameter <CrashProbability, double>(GenericType <CrashProbability> .Class, "1.0")
                                   .Build();

                value.SubmitContext(Configurations.Merge(contextConfig, poisonConfig));
            }
Example #13
0
 public virtual void OnNext(IAllocatedEvaluator value)
 {
     value.SubmitContext(ContextConfiguration.ConfigurationModule
                         .Set(ContextConfiguration.Identifier, ContextId)
                         .Build());
 }