Exemplo n.º 1
0
        public CloudManagerLocal(List <CloudMakefile> leaderCloudMakefiles, CloudMakefile localCloudMakefile,
                                 string name, List <List <string> > leaders, List <string> reserveLeaders, int nreplicas,
                                 int timeout, Vsync.Group vsyncGroup, string debugFilename,
                                 string monitorDebugFilename)
        {
            _vsyncAddress         = VsyncSystem.GetMyAddress().ToStringVerboseFormat();
            _name                 = name;
            _curDirectory         = Directory.GetCurrentDirectory();
            _procs                = new Dictionary <string, ProcessInfo> ();
            _procsLock            = new object();
            _leaders              = leaders;
            _reserveLeaders       = reserveLeaders;
            _nreplicas            = nreplicas;
            _leaderCloudMakefiles = leaderCloudMakefiles;
            _localCloudMakefile   = localCloudMakefile;
            _queue                = new List <Tuple <MessageType, List <string> > > ();
            _queueLock            = new object();
            _debugFilename        = debugFilename;
            _cloudMakeMonitor     = new CloudMakeMonitor(this, monitorDebugFilename, timeout);
            Thread cloudMakeMonitorThread = new Thread(delegate() {
                _cloudMakeMonitor.Run(vsyncGroup);
            });

            cloudMakeMonitorThread.Start();
        }
Exemplo n.º 2
0
 public CloudManagerLeader(List <CloudMakefile> leaderCloudMakefiles,
                           Dictionary <string, CloudMakefile> localCloudMakefiles,
                           Dictionary <string, string> nameToAddress, Dictionary <string, string> addressToName,
                           List <List <string> > leaders, List <string> reserveLeaders, int nreplicas,
                           string workingDir, string debugFilename)
 {
     _vsyncAddress         = VsyncSystem.GetMyAddress().ToStringVerboseFormat();
     _leaders              = leaders;
     _reserveLeaders       = reserveLeaders;
     _nreplicas            = nreplicas;
     _leaderCloudMakefiles = leaderCloudMakefiles;
     _localCloudMakefiles  = localCloudMakefiles;
     _partition            = CloudManager.FindPartition(_leaders, _reserveLeaders, _vsyncAddress);
     if (_partition >= 0)
     {
         _rank  = _leaders [_partition].IndexOf(_vsyncAddress);
         _state = _rank == 0 ? State.ACTIVE : State.WAITFORSTATE;
     }
     else if (_partition == -1)
     {
         _rank  = _reserveLeaders.IndexOf(_vsyncAddress);
         _state = State.INITIAL;
     }
     else
     {
         throw new Exception("CloudMakeLeader: I cannot find myself.\n");
     }
     _nameToAddress    = nameToAddress;
     _addressToName    = addressToName;
     _queue            = new List <Tuple <MessageType, List <string> > > ();
     _queueLock        = new object();
     _pending          = new List <Tuple <MessageType, List <string> > > ();
     _updatesDelivered = 0;
     _debugFilename    = debugFilename;
     _workingDir       = workingDir;
     if (!Directory.Exists(_workingDir))
     {
         throw new Exception("CloudMakeLeader: CloudMakeLeader directory " + _workingDir + " does not exist.");
     }
     Directory.SetCurrentDirectory(_workingDir);
 }