Exemple #1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="appLoggingContext">Application-level logging context</param>
        /// <param name="maxProcesses">the maximum number of concurrent pips on the worker</param>
        /// <param name="config">Distribution config</param>\
        /// <param name="buildId">the build id</param>
        public WorkerService(LoggingContext appLoggingContext, int maxProcesses, IDistributionConfiguration config, string buildId)
        {
            m_isGrpcEnabled = config.IsGrpcEnabled;

            m_appLoggingContext = appLoggingContext;
            m_maxProcesses      = maxProcesses;
            m_port     = config.BuildServicePort;
            m_services = new DistributionServices(buildId);
            if (m_isGrpcEnabled)
            {
                m_workerServer = new Grpc.GrpcWorkerServer(this, appLoggingContext, buildId);
            }
            else
            {
#if !DISABLE_FEATURE_BOND_RPC
                m_bondWorkerService = new InternalBond.BondWorkerServer(appLoggingContext, this, m_port, m_services);
                m_workerServer      = m_bondWorkerService;
#endif
            }

            m_attachCompletionSource    = TaskSourceSlim.Create <bool>();
            m_exitCompletionSource      = TaskSourceSlim.Create <bool>();
            m_workerRunnablePipObserver = new WorkerRunnablePipObserver(this);
            m_sendThread = new Thread(SendBuildResults);
        }
Exemple #2
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
            }
        }
Exemple #3
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="appLoggingContext">Application-level logging context</param>
        /// <param name="maxProcesses">the maximum number of concurrent pips on the worker</param>
        /// <param name="config">Distribution config</param>\
        /// <param name="buildId">the build id</param>
        public WorkerService(LoggingContext appLoggingContext, int maxProcesses, IDistributionConfiguration config, string buildId)
        {
            m_appLoggingContext = appLoggingContext;
            m_maxProcesses      = maxProcesses;
            m_port         = config.BuildServicePort;
            m_services     = new DistributionServices(buildId);
            m_workerServer = new Grpc.GrpcWorkerServer(this, appLoggingContext, buildId);

            m_attachCompletionSource    = TaskSourceSlim.Create <bool>();
            m_exitCompletionSource      = TaskSourceSlim.Create <bool>();
            m_workerRunnablePipObserver = new WorkerRunnablePipObserver(this);
            m_sendThread = new Thread(SendBuildResults);
        }
Exemple #4
0
        /// <nodoc/>
        public WorkerNotificationManager(WorkerService workerService, EngineSchedule schedule, IPipExecutionEnvironment environment, DistributionServices services)
        {
            WorkerService        = workerService;
            DistributionServices = services;

            m_scheduler   = schedule.Scheduler;
            m_environment = environment;

            m_forwardingEventListener = new ForwardingEventListener(this);
            m_sendCancellationSource  = new CancellationTokenSource();
            m_pipResultListener       = new PipResultListener(this, schedule, environment);
            m_sendThread = new Thread(() => SendNotifications(m_sendCancellationSource.Token));
        }
        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);
        }
Exemple #6
0
 public NotifyStream(uint workerId, IMasterClient masterClient, DistributionServices services)
 {
     m_workerId     = workerId;
     m_masterClient = masterClient;
     m_services     = services;
 }
Exemple #7
0
 internal NotifyMasterExecutionLogTarget(uint workerId, IMasterClient masterClient, PipExecutionContext context, Guid logId, int lastStaticAbsolutePathIndex, DistributionServices services)
     : this(new NotifyStream(workerId, masterClient, services), context, logId, lastStaticAbsolutePathIndex)
 {
 }