зеркало из https://github.com/microsoft/BuildXL.git
Merged PR 788202: Pass OrchestratorIpAddress to cache initialization
Pass OrchestratorIpAddress to cache initialization
This commit is contained in:
Родитель
5914404e99
Коммит
ae9f2c5348
|
@ -78,7 +78,7 @@ namespace BuildXL.Engine
|
|||
RootTranslator rootTranslator,
|
||||
bool? recoveryStatus,
|
||||
CancellationToken cancellationToken,
|
||||
|
||||
string orchestratorIpAddress = null,
|
||||
// Only used for testing purposes to inject cache.
|
||||
Func<EngineCache> testHookCacheFactory = null)
|
||||
{
|
||||
|
@ -110,7 +110,8 @@ namespace BuildXL.Engine
|
|||
cacheDirectory,
|
||||
config,
|
||||
enableFingerprintLookup: config.Cache.Incremental,
|
||||
rootTranslator);
|
||||
rootTranslator,
|
||||
orchestratorIpAddress);
|
||||
|
||||
if (!maybeCacheCoreEngineCache.Succeeded)
|
||||
{
|
||||
|
@ -269,8 +270,8 @@ namespace BuildXL.Engine
|
|||
PathTable pathTable,
|
||||
string cacheDirectory,
|
||||
ICacheConfiguration config,
|
||||
RootTranslator rootTranslator = null,
|
||||
IDistributionConfiguration distributionConfiguration = null)
|
||||
string orchestratorIpAddress,
|
||||
RootTranslator rootTranslator)
|
||||
{
|
||||
Contract.Requires(pathTable != null);
|
||||
Contract.Requires(pathTable.IsValid);
|
||||
|
@ -301,12 +302,12 @@ namespace BuildXL.Engine
|
|||
cacheConfigContent = cacheConfigContent.Replace("[BuildXLCacheUniverse]", EngineEnvironmentSettings.CacheUniverse.Value ?? string.Empty);
|
||||
cacheConfigContent = cacheConfigContent.Replace("[BuildXLCacheNamespace]", EngineEnvironmentSettings.CacheNamespace.Value ?? string.Empty);
|
||||
|
||||
var orchestratorLocation = distributionConfiguration?.OrchestratorLocation?.IpAddress;
|
||||
if (string.IsNullOrEmpty(orchestratorLocation))
|
||||
if (string.IsNullOrEmpty(orchestratorIpAddress))
|
||||
{
|
||||
orchestratorLocation = Environment.MachineName;
|
||||
orchestratorIpAddress = Environment.MachineName;
|
||||
}
|
||||
cacheConfigContent = cacheConfigContent.Replace("[BuildXLSelectedLeader]", orchestratorLocation);
|
||||
|
||||
cacheConfigContent = cacheConfigContent.Replace("[BuildXLSelectedLeader]", orchestratorIpAddress);
|
||||
|
||||
var vfsCasRoot = config.VfsCasRoot.IsValid
|
||||
? config.VfsCasRoot.ToString(pathTable)
|
||||
|
@ -346,7 +347,8 @@ namespace BuildXL.Engine
|
|||
string cacheDirectory,
|
||||
IConfiguration config,
|
||||
bool enableFingerprintLookup,
|
||||
RootTranslator rootTranslator)
|
||||
RootTranslator rootTranslator,
|
||||
string orchestratorIpAddress)
|
||||
{
|
||||
Contract.Requires(pathTable != null);
|
||||
Contract.Requires(pathTable.IsValid);
|
||||
|
@ -360,7 +362,7 @@ namespace BuildXL.Engine
|
|||
ICacheCoreSession session = null;
|
||||
try
|
||||
{
|
||||
Possible<ICacheConfigData> cacheConfigData = TryGetCacheConfigData(pathTable, cacheDirectory, config.Cache, rootTranslator, config.Distribution);
|
||||
Possible<ICacheConfigData> cacheConfigData = TryGetCacheConfigData(pathTable, cacheDirectory, config.Cache, orchestratorIpAddress, rootTranslator);
|
||||
if (!cacheConfigData.Succeeded)
|
||||
{
|
||||
return cacheConfigData.Failure;
|
||||
|
|
|
@ -90,6 +90,9 @@ namespace BuildXL.Engine.Distribution
|
|||
|
||||
private readonly ConcurrentBigSet<int> m_handledBuildRequests = new ConcurrentBigSet<int>();
|
||||
|
||||
/// <nodoc/>
|
||||
public string OrchestratorIpAddress { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the worker
|
||||
/// </summary>
|
||||
|
@ -215,6 +218,7 @@ namespace BuildXL.Engine.Distribution
|
|||
|
||||
internal bool SayHello(IDistributionServiceLocation orchestratorLocation)
|
||||
{
|
||||
OrchestratorIpAddress = orchestratorLocation.IpAddress;
|
||||
var timeout = GrpcSettings.WorkerAttachTimeout;
|
||||
Logger.Log.DistributionSayingHelloToOrchestrator(m_appLoggingContext);
|
||||
var helloTask = ((IWorkerService)this).SayHelloAsync(orchestratorLocation);
|
||||
|
@ -397,6 +401,7 @@ namespace BuildXL.Engine.Distribution
|
|||
m_orchestratorClient.Initialize(buildStartData.OrchestratorLocation.IpAddress, buildStartData.OrchestratorLocation.Port, OnConnectionFailureAsync);
|
||||
}
|
||||
|
||||
OrchestratorIpAddress = buildStartData.OrchestratorLocation.IpAddress;
|
||||
WorkerId = BuildStartData.WorkerId;
|
||||
m_attachCallCompletion.TrySetResult(true);
|
||||
}
|
||||
|
|
|
@ -1839,6 +1839,8 @@ namespace BuildXL.Engine
|
|||
|
||||
try
|
||||
{
|
||||
string orchestratorIpAddress = null;
|
||||
|
||||
if (Configuration.Distribution.BuildRole == DistributedBuildRoles.Worker)
|
||||
{
|
||||
if (Configuration.Distribution.OrchestratorLocation != null)
|
||||
|
@ -1862,6 +1864,8 @@ namespace BuildXL.Engine
|
|||
"An error should have been logged during waiting for attaching to the orchestrator.");
|
||||
return BuildXLEngineResult.Failed(engineState);
|
||||
}
|
||||
|
||||
orchestratorIpAddress = m_workerService.OrchestratorIpAddress;
|
||||
}
|
||||
|
||||
cacheInitializationTask = CacheInitializer.GetCacheInitializationTask(
|
||||
|
@ -1870,6 +1874,7 @@ namespace BuildXL.Engine
|
|||
Configuration.Layout.CacheDirectory.ToString(Context.PathTable),
|
||||
Configuration.Logging.LogsDirectory.ToString(Context.PathTable),
|
||||
Configuration,
|
||||
orchestratorIpAddress: orchestratorIpAddress,
|
||||
rootTranslator: m_rootTranslator,
|
||||
recoveryStatus: recoveryStatus,
|
||||
cancellationToken: Context.CancellationToken,
|
||||
|
|
Загрузка…
Ссылка в новой задаче