/// <summary> /// Initialize the grain client. This should be already done by <see cref="Deploy()"/> or <see cref="DeployAsync"/> /// </summary> public void InitializeClient() { WriteLog("Initializing Grain Client"); ClientConfiguration clientConfig = this.ClientConfiguration; if (Debugger.IsAttached) { // Test is running inside debugger - Make timeout ~= infinite clientConfig.ResponseTimeout = TimeSpan.FromMilliseconds(1000000); } this.InternalClient = (IInternalClusterClient) new ClientBuilder() .UseConfiguration(clientConfig) .ConfigureLogging(builder => TestingUtils.ConfigureDefaultLoggingBuilder(builder, clientConfig.TraceFileName)).Build(); this.InternalClient.Connect().Wait(); this.SerializationManager = this.ServiceProvider.GetRequiredService <SerializationManager>(); this.StreamProviderManager = this.ServiceProvider.GetRequiredService <IRuntimeClient>().CurrentStreamProviderManager; }
/// <summary> /// Get the timeout value to use to wait for the silo liveness sub-system to detect and act on any recent cluster membership changes. /// <seealso cref="WaitForLivenessToStabilizeAsync"/> /// </summary> public static TimeSpan GetLivenessStabilizationTime(GlobalConfiguration global, bool didKill = false) { TimeSpan stabilizationTime = TimeSpan.Zero; if (didKill) { // in case of hard kill (kill and not Stop), we should give silos time to detect failures first. stabilizationTime = TestingUtils.Multiply(global.ProbeTimeout, global.NumMissedProbesLimit); } if (global.UseLivenessGossip) { stabilizationTime += TimeSpan.FromSeconds(5); } else { stabilizationTime += TestingUtils.Multiply(global.TableRefreshTimeout, 2); } return(stabilizationTime); }
/// <summary> /// Get the timeout value to use to wait for the silo liveness sub-system to detect and act on any recent cluster membership changes. /// <seealso cref="WaitForLivenessToStabilizeAsync"/> /// </summary> public static TimeSpan GetLivenessStabilizationTime(ClusterMembershipOptions clusterMembershipOptions, bool didKill = false) { TimeSpan stabilizationTime = TimeSpan.Zero; if (didKill) { // in case of hard kill (kill and not Stop), we should give silos time to detect failures first. stabilizationTime = TestingUtils.Multiply(clusterMembershipOptions.ProbeTimeout, clusterMembershipOptions.NumMissedProbesLimit); } if (clusterMembershipOptions.UseLivenessGossip) { stabilizationTime += TimeSpan.FromSeconds(5); } else { stabilizationTime += TestingUtils.Multiply(clusterMembershipOptions.TableRefreshTimeout, 2); } return(stabilizationTime); }
public ISiloHostBuilder CreateSiloBuilder(string siloName, ClusterConfiguration clusterConfiguration) { var builder = new SiloHostBuilder(); return(builder.ConfigureSiloName(siloName) .ConfigureApplicationParts(parts => parts.AddFromAppDomain()) .UseConfiguration(clusterConfiguration) .ConfigureLogging(loggingBuilder => TestingUtils.ConfigureDefaultLoggingBuilder(loggingBuilder, TestingUtils.CreateTraceFileName(siloName, clusterConfiguration.Globals.ClusterId)))); }