public InfiniteTimerStandbyManager(IScriptHostManager scriptHostManager, ILanguageWorkerChannelManager languageWorkerChannelManager, IConfiguration configuration, IScriptWebHostEnvironment webHostEnvironment, IEnvironment environment, IOptionsMonitor <ScriptApplicationHostOptions> options, ILogger <StandbyManager> logger, HostNameProvider hostNameProvider) : base(scriptHostManager, languageWorkerChannelManager, configuration, webHostEnvironment, environment, options, logger, hostNameProvider, TimeSpan.FromMilliseconds(-1)) { }
public RpcInitializationService(IOptionsMonitor <ScriptApplicationHostOptions> applicationHostOptions, IEnvironment environment, IRpcServer rpcServer, ILanguageWorkerChannelManager languageWorkerChannelManager, ILoggerFactory loggerFactory) { _applicationHostOptions = applicationHostOptions ?? throw new ArgumentNullException(nameof(applicationHostOptions)); _logger = loggerFactory.CreateLogger(ScriptConstants.LogCategoryRpcInitializationService); _rpcServer = rpcServer; _environment = environment; _languageWorkerChannelManager = languageWorkerChannelManager ?? throw new ArgumentNullException(nameof(languageWorkerChannelManager)); }
private async Task <int> WaitForWebhostWorkerChannelsToStartup(ILanguageWorkerChannelManager channelManager, int expectedCount, string language) { int currentChannelCount = 0; await TestHelpers.Await(() => { currentChannelCount = channelManager.GetChannels(language).Count(); return(currentChannelCount == expectedCount); }, pollingInterval : 4 * 1000, timeout : 60 * 1000); return(currentChannelCount); }
public StandbyManager(IScriptHostManager scriptHostManager, ILanguageWorkerChannelManager languageWorkerChannelManager, IConfiguration configuration, IScriptWebHostEnvironment webHostEnvironment, IEnvironment environment, IOptionsMonitor <ScriptApplicationHostOptions> options, ILogger <StandbyManager> logger) { _scriptHostManager = scriptHostManager ?? throw new ArgumentNullException(nameof(scriptHostManager)); _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _specializationTask = new Lazy <Task>(SpecializeHostCoreAsync, LazyThreadSafetyMode.ExecutionAndPublication); _webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _configuration = configuration as IConfigurationRoot ?? throw new ArgumentNullException(nameof(configuration)); _languageWorkerChannelManager = languageWorkerChannelManager ?? throw new ArgumentNullException(nameof(languageWorkerChannelManager)); }
public StandbyManager(IScriptHostManager scriptHostManager, ILanguageWorkerChannelManager languageWorkerChannelManager, IConfiguration configuration, IScriptWebHostEnvironment webHostEnvironment, IEnvironment environment, IOptionsMonitor <ScriptApplicationHostOptions> options, ILogger <StandbyManager> logger, HostNameProvider hostNameProvider) { _scriptHostManager = scriptHostManager ?? throw new ArgumentNullException(nameof(scriptHostManager)); _options = options ?? throw new ArgumentNullException(nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _specializationTask = new Lazy <Task>(SpecializeHostCoreAsync, LazyThreadSafetyMode.ExecutionAndPublication); _webHostEnvironment = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment)); _environment = environment ?? throw new ArgumentNullException(nameof(environment)); _configuration = configuration as IConfigurationRoot ?? throw new ArgumentNullException(nameof(configuration)); _languageWorkerChannelManager = languageWorkerChannelManager ?? throw new ArgumentNullException(nameof(languageWorkerChannelManager)); _hostNameProvider = hostNameProvider ?? throw new ArgumentNullException(nameof(hostNameProvider)); _changeTokenCallbackSubscription = ChangeToken.RegisterChangeCallback(_ => _logger.LogDebug($"{nameof(StandbyManager)}.{nameof(ChangeToken)} callback has fired."), null); }
public FunctionDispatcher(IOptions <ScriptJobHostOptions> scriptHostOptions, IMetricsLogger metricsLogger, IScriptEventManager eventManager, ILoggerFactory loggerFactory, IOptions <LanguageWorkerOptions> languageWorkerOptions, ILanguageWorkerChannelManager languageWorkerChannelManager) { _metricsLogger = metricsLogger; _scriptOptions = scriptHostOptions.Value; _languageWorkerChannelManager = languageWorkerChannelManager; _eventManager = eventManager; _workerConfigs = languageWorkerOptions.Value.WorkerConfigs; _logger = loggerFactory.CreateLogger(ScriptConstants.LogCategoryFunctionDispatcher); _workerErrorSubscription = _eventManager.OfType <WorkerErrorEvent>() .Subscribe(WorkerError); }
public FunctionDispatcher(IOptions <ScriptJobHostOptions> scriptHostOptions, IMetricsLogger metricsLogger, IEnvironment environment, IScriptJobHostEnvironment scriptJobHostEnvironment, IScriptEventManager eventManager, ILoggerFactory loggerFactory, IOptions <LanguageWorkerOptions> languageWorkerOptions, ILanguageWorkerChannelManager languageWorkerChannelManager, IOptions <ManagedDependencyOptions> managedDependencyOptions, IFunctionDispatcherLoadBalancer functionDispatcherLoadBalancer) { _metricsLogger = metricsLogger; _scriptOptions = scriptHostOptions.Value; _environment = environment; _scriptJobHostEnvironment = scriptJobHostEnvironment; _languageWorkerChannelManager = languageWorkerChannelManager; _eventManager = eventManager; _workerConfigs = languageWorkerOptions.Value.WorkerConfigs; _managedDependencyOptions = managedDependencyOptions; _logger = loggerFactory.CreateLogger <FunctionDispatcher>(); _workerRuntime = _environment.GetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName); var processCount = _environment.GetEnvironmentVariable(LanguageWorkerConstants.FunctionsWorkerProcessCountSettingName); _maxProcessCount = (processCount != null && int.Parse(processCount) > 1) ? int.Parse(processCount) : 1; _maxProcessCount = _maxProcessCount > _maxAllowedProcessCount ? _maxAllowedProcessCount : _maxProcessCount; _functionDispatcherLoadBalancer = functionDispatcherLoadBalancer; State = FunctionDispatcherState.Default; _workerErrorSubscription = _eventManager.OfType <WorkerErrorEvent>() .Subscribe(WorkerError); _rpcChannelReadySubscriptions = _eventManager.OfType <RpcJobHostChannelReadyEvent>() .ObserveOn(NewThreadScheduler.Default) .Subscribe(AddOrUpdateWorkerChannels); _shutdownStandbyWorkerChannels = ShutdownWebhostLanguageWorkerChannels; _shutdownStandbyWorkerChannels = _shutdownStandbyWorkerChannels.Debounce(5000); }
public NodeContentTests(TestFixture fixture) { Fixture = fixture; _languageWorkerChannelManager = (ILanguageWorkerChannelManager)fixture.Host.Services.GetService(typeof(ILanguageWorkerChannelManager)); }