Example #1
0
        private EvaluatorSettings(
            [Parameter(typeof(ApplicationIdentifier))] string applicationId,
            [Parameter(typeof(EvaluatorIdentifier))] string evaluatorId,
            [Parameter(typeof(EvaluatorHeartbeatPeriodInMs))] int heartbeatPeriodInMs,
            [Parameter(typeof(HeartbeatMaxRetry))] int maxHeartbeatRetries,
            [Parameter(typeof(RootContextConfiguration))] string rootContextConfigString,
            RuntimeClock clock,
            IRemoteManagerFactory remoteManagerFactory,
            REEFMessageCodec reefMessageCodec,
            IInjector injector)
        {
            _injector            = injector;
            _applicationId       = applicationId;
            _evaluatorId         = evaluatorId;
            _heartBeatPeriodInMs = heartbeatPeriodInMs;
            _maxHeartbeatRetries = maxHeartbeatRetries;
            _clock = clock;

            if (string.IsNullOrWhiteSpace(rootContextConfigString))
            {
                Utilities.Diagnostics.Exceptions.Throw(
                    new ArgumentException("empty or null rootContextConfigString"), Logger);
            }
            _rootContextConfig        = new ContextConfiguration(rootContextConfigString);
            _rootTaskConfiguration    = CreateTaskConfiguration();
            _rootServiceConfiguration = CreateRootServiceConfiguration();

            _remoteManager  = remoteManagerFactory.GetInstance(reefMessageCodec);
            _operationState = EvaluatorOperationState.OPERATIONAL;
        }
Example #2
0
 public EvaluatorSettings(
     string applicationId,
     string evaluatorId,
     int heartbeatPeriodInMs,
     int maxHeartbeatRetries,
     ContextConfiguration rootContextConfig,
     IClock clock,
     IRemoteManager <REEFMessage> remoteManager,
     IInjector injecor)
 {
     if (string.IsNullOrWhiteSpace(evaluatorId))
     {
         throw new ArgumentNullException("evaluatorId");
     }
     if (rootContextConfig == null)
     {
         throw new ArgumentNullException("rootContextConfig");
     }
     if (clock == null)
     {
         throw new ArgumentNullException("clock");
     }
     if (remoteManager == null)
     {
         throw new ArgumentNullException("remoteManager");
     }
     if (injecor == null)
     {
         throw new ArgumentNullException("injecor");
     }
     _applicationId       = applicationId;
     _evaluatorId         = evaluatorId;
     _heartBeatPeriodInMs = heartbeatPeriodInMs;
     _maxHeartbeatRetries = maxHeartbeatRetries;
     _rootContextConfig   = rootContextConfig;
     _clock          = clock;
     _remoteManager  = remoteManager;
     _injector       = injecor;
     _operationState = EvaluatorOperationState.OPERATIONAL;
 }
Example #3
0
        private EvaluatorSettings(
            [Parameter(typeof(ApplicationIdentifier))] string applicationId,
            [Parameter(typeof(EvaluatorIdentifier))] string evaluatorId,
            [Parameter(typeof(EvaluatorHeartbeatPeriodInMs))] int heartbeatPeriodInMs,
            [Parameter(typeof(HeartbeatMaxRetry))] int maxHeartbeatRetries,
            [Parameter(typeof(RootContextConfiguration))] string rootContextConfigString,
            AvroConfigurationSerializer serializer,
            RuntimeClock clock,
            IRemoteManagerFactory remoteManagerFactory,
            REEFMessageCodec reefMessageCodec,
            IInjector injector,
            INameClient nameClient)
        {
            _serializer = serializer;
            _injector = injector;
            _applicationId = applicationId;
            _evaluatorId = evaluatorId;
            _heartBeatPeriodInMs = heartbeatPeriodInMs;
            _maxHeartbeatRetries = maxHeartbeatRetries;
            _clock = clock;

            if (string.IsNullOrWhiteSpace(rootContextConfigString))
            {
                Utilities.Diagnostics.Exceptions.Throw(
                    new ArgumentException("empty or null rootContextConfigString"), Logger);
            }
            _rootContextConfig = _serializer.FromString(rootContextConfigString);

            try
            {
                _rootContextId = injector.ForkInjector(_rootContextConfig).GetNamedInstance<ContextConfigurationOptions.ContextIdentifier, string>();
            }
            catch (InjectionException)
            {
                Logger.Log(Level.Info, "Using deprecated ContextConfiguration.");

                // TODO[JIRA REEF-1167]: Remove this catch.
                var deprecatedContextConfig = new Context.ContextConfiguration(rootContextConfigString);
                _rootContextConfig = deprecatedContextConfig;
                _rootContextId = deprecatedContextConfig.Id;
            }

            _rootTaskConfiguration = CreateTaskConfiguration();
            _rootServiceConfiguration = CreateRootServiceConfiguration();

            _remoteManager = remoteManagerFactory.GetInstance(reefMessageCodec);
            _operationState = EvaluatorOperationState.OPERATIONAL;
            _nameClient = nameClient;
        }
 public EvaluatorSettings(
     string applicationId,
     string evaluatorId,
     int heartbeatPeriodInMs,
     int maxHeartbeatRetries,
     ContextConfiguration rootContextConfig,
     IClock clock,
     IRemoteManager<REEFMessage> remoteManager,
     IInjector injecor)
 {
     if (string.IsNullOrWhiteSpace(evaluatorId))
     {
         throw new ArgumentNullException("evaluatorId");
     }
     if (rootContextConfig == null)
     {
         throw new ArgumentNullException("rootContextConfig");
     }
     if (clock == null)
     {
         throw new ArgumentNullException("clock");
     }
     if (remoteManager == null)
     {
         throw new ArgumentNullException("remoteManager");
     }
     if (injecor == null)
     {
         throw new ArgumentNullException("injecor");
     }
     _applicationId = applicationId;
     _evaluatorId = evaluatorId;
     _heartBeatPeriodInMs = heartbeatPeriodInMs;
     _maxHeartbeatRetries = maxHeartbeatRetries;
     _rootContextConfig = rootContextConfig;
     _clock = clock;
     _remoteManager = remoteManager;
     _injector = injecor;
     _operationState = EvaluatorOperationState.OPERATIONAL;
 }
Example #5
0
        private EvaluatorSettings(
            [Parameter(typeof(ApplicationIdentifier))] string applicationId,
            [Parameter(typeof(EvaluatorIdentifier))] string evaluatorId,
            [Parameter(typeof(EvaluatorHeartbeatPeriodInMs))] int heartbeatPeriodInMs,
            [Parameter(typeof(HeartbeatMaxRetry))] int maxHeartbeatRetries,
            [Parameter(typeof(RootContextConfiguration))] string rootContextConfigString,
            RuntimeClock clock,
            IRemoteManagerFactory remoteManagerFactory,
            REEFMessageCodec reefMessageCodec,
            IInjector injector)
        {
            _injector = injector;
            _applicationId = applicationId;
            _evaluatorId = evaluatorId;
            _heartBeatPeriodInMs = heartbeatPeriodInMs;
            _maxHeartbeatRetries = maxHeartbeatRetries;
            _clock = clock;

            if (string.IsNullOrWhiteSpace(rootContextConfigString))
            {
                Utilities.Diagnostics.Exceptions.Throw(
                    new ArgumentException("empty or null rootContextConfigString"), Logger);
            }
            _rootContextConfig = new ContextConfiguration(rootContextConfigString);
            _rootTaskConfiguration = CreateTaskConfiguration();
            _rootServiceConfiguration = CreateRootServiceConfiguration();

            _remoteManager = remoteManagerFactory.GetInstance(reefMessageCodec);
            _operationState = EvaluatorOperationState.OPERATIONAL;
        }