コード例 #1
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);
            }
        }
コード例 #2
0
        public void OnNext(IAllocatedEvaluator eval)
        {
            Logger.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received evaluator. Runtime Name: {0}.", eval.GetEvaluatorDescriptor().RuntimeName));
            string taskId = "Task_" + eval.Id;

            IConfiguration contextConfiguration = ContextConfiguration.ConfigurationModule
                                                  .Set(ContextConfiguration.Identifier, taskId)
                                                  .Build();

            IConfiguration taskConfiguration = TaskConfiguration.ConfigurationModule
                                               .Set(TaskConfiguration.Identifier, taskId)
                                               .Set(TaskConfiguration.Task, GenericType <RuntimeNameTask> .Class)
                                               .Build();

            eval.SubmitContextAndTask(contextConfiguration, taskConfiguration);
        }
コード例 #3
0
 public void OnNext(IAllocatedEvaluator eval)
 {
     Logger.Log(Level.Info, string.Format(CultureInfo.InvariantCulture, "Received evaluator. Runtime Name: {0}.", eval.GetEvaluatorDescriptor().RuntimeName));
     eval.Dispose();
 }
コード例 #4
0
ファイル: IMRUDriver.cs プロジェクト: InsightsDev-dev/reef
        /// <summary>
        /// IAllocatedEvaluator handler. It will take the following action based on the system state:
        /// Case WaitingForEvaluator
        ///    Add Evaluator to the Evaluator Manager
        ///    submit Context and Services
        /// Case Fail
        ///    Do nothing. This is because the code that sets system Fail has executed FailedAction. It has shut down all the allocated evaluators/contexts.
        ///    If a new IAllocatedEvaluator comes after it, we should not submit anything so that the evaluator is returned.
        /// Other cases - not expected
        /// </summary>
        /// <param name="allocatedEvaluator">The allocated evaluator</param>
        public void OnNext(IAllocatedEvaluator allocatedEvaluator)
        {
            Logger.Log(Level.Info, "AllocatedEvaluator memory [{0}], systemState {1}.", allocatedEvaluator.GetEvaluatorDescriptor().Memory, _systemState.CurrentState);
            lock (_lock)
            {
                using (Logger.LogFunction("IMRUDriver::IAllocatedEvaluator"))
                {
                    switch (_systemState.CurrentState)
                    {
                    case SystemState.WaitingForEvaluator:
                        if (!_evaluatorManager.IsMasterEvaluatorAllocated())
                        {
                            _evaluatorManager.AddMasterEvaluator(allocatedEvaluator);
                            _evaluatorManager.RequestMapEvaluators(_totalMappers);
                        }
                        else
                        {
                            _evaluatorManager.AddAllocatedEvaluator(allocatedEvaluator);
                        }
                        SubmitContextAndService(allocatedEvaluator);
                        break;

                    case SystemState.Fail:
                        Logger.Log(Level.Info,
                                   "Receiving IAllocatedEvaluator event, but system is in FAIL state, ignore it.");
                        allocatedEvaluator.Dispose();
                        break;

                    default:
                        UnexpectedState(allocatedEvaluator.Id, "IAllocatedEvaluator");
                        break;
                    }
                }
            }
        }