示例#1
0
        public MasterService(IDistributionConfiguration config, LoggingContext loggingContext, string buildId)
        {
            Contract.Requires(config != null && config.BuildRole == DistributedBuildRoles.Master);
            Contract.Ensures(m_remoteWorkers != null);

            m_isGrpcEnabled = config.IsGrpcEnabled;

            // Create all remote workers
            m_buildServicePort = config.BuildServicePort;
            m_remoteWorkers    = new RemoteWorker[config.BuildWorkers.Count];

            m_loggingContext     = loggingContext;
            DistributionServices = new DistributionServices(buildId);

            for (int i = 0; i < m_remoteWorkers.Length; i++)
            {
                var configWorker    = config.BuildWorkers[i];
                var workerId        = i + 1; // 0 represents the local worker.
                var serviceLocation = new ServiceLocation {
                    IpAddress = configWorker.IpAddress, Port = configWorker.BuildServicePort
                };
                m_remoteWorkers[i] = new RemoteWorker(m_isGrpcEnabled, loggingContext, (uint)workerId, this, serviceLocation);
            }

            if (m_isGrpcEnabled)
            {
                m_masterServer = new Grpc.GrpcMasterServer(loggingContext, this, buildId);
            }
            else
            {
#if !DISABLE_FEATURE_BOND_RPC
                m_masterServer = new InternalBond.BondMasterServer(loggingContext, this);
#endif
            }
        }
示例#2
0
        public OrchestratorService(IDistributionConfiguration config, LoggingContext loggingContext, DistributedInvocationId invocationId, PipExecutionContext context) : base(invocationId)
        {
            Contract.Requires(config != null && config.BuildRole.IsOrchestrator());

            // Create all remote workers
            m_buildServicePort = config.BuildServicePort;
            m_remoteWorkers    = new RemoteWorker[config.BuildWorkers.Count];

            m_loggingContext = loggingContext;

            for (int i = 0; i < m_remoteWorkers.Length; i++)
            {
                var configWorker    = config.BuildWorkers[i];
                var workerId        = i + 1; // 0 represents the local worker.
                var serviceLocation = new ServiceLocation {
                    IpAddress = configWorker.IpAddress, Port = configWorker.BuildServicePort
                };
                m_remoteWorkers[i] = new RemoteWorker(loggingContext, (uint)workerId, this, serviceLocation, context);
            }

            m_orchestratorServer = new Grpc.GrpcOrchestratorServer(loggingContext, this, invocationId);
        }
        public MasterService(IDistributionConfiguration config, LoggingContext loggingContext, string buildId)
        {
            Contract.Requires(config != null && config.BuildRole == DistributedBuildRoles.Master);
            Contract.Ensures(m_remoteWorkers != null);

            // Create all remote workers
            m_buildServicePort = config.BuildServicePort;
            m_remoteWorkers    = new RemoteWorker[config.BuildWorkers.Count];

            m_loggingContext     = loggingContext;
            DistributionServices = new DistributionServices(buildId);

            for (int i = 0; i < m_remoteWorkers.Length; i++)
            {
                var configWorker    = config.BuildWorkers[i];
                var workerId        = i + 1; // 0 represents the local worker.
                var serviceLocation = new ServiceLocation {
                    IpAddress = configWorker.IpAddress, Port = configWorker.BuildServicePort
                };
                m_remoteWorkers[i] = new RemoteWorker(loggingContext, (uint)workerId, this, serviceLocation);
            }

            m_masterServer = new Grpc.GrpcMasterServer(loggingContext, this, buildId);
        }