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; }
/// <summary> /// Add a context to the stack. /// </summary> /// <param name="addContextProto"></param> private void AddContext(AddContextProto addContextProto) { lock (_contextLock) { var currentTopContext = _topContext; if (!currentTopContext.Id.Equals(addContextProto.parent_context_id, StringComparison.OrdinalIgnoreCase)) { var e = new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Trying to instantiate a child context on context with id '{0}' while the current top context id is {1}", addContextProto.parent_context_id, currentTopContext.Id)); Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } string contextConfigString = addContextProto.context_configuration; var contextConfiguration = new ContextConfiguration(contextConfigString); ContextRuntime newTopContext; if (addContextProto.service_configuration != null) { var serviceConfiguration = new ServiceConfiguration(addContextProto.service_configuration); newTopContext = currentTopContext.SpawnChildContext(contextConfiguration, serviceConfiguration.TangConfig); } else { newTopContext = currentTopContext.SpawnChildContext(contextConfiguration); } _topContext = newTopContext; } }
public RootContextLauncher(ContextConfiguration rootContextConfig, Optional <ServiceConfiguration> rootServiceConfig, Optional <TaskConfiguration> rootTaskConfig) { _rootContextConfiguration = rootContextConfig; _rootServiceInjector = InjectServices(rootServiceConfig); RootTaskConfig = rootTaskConfig; }
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 RootContextLauncher(ContextConfiguration rootContextConfig, Optional<ServiceConfiguration> rootServiceConfig, Optional<TaskConfiguration> rootTaskConfig) { _rootContextConfiguration = rootContextConfig; _rootServiceInjector = InjectServices(rootServiceConfig); RootTaskConfig = rootTaskConfig; }
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; }