Exemplo n.º 1
0
 private void RunCloudMake(Vsync.Group vsyncGroup)
 {
     _dependencyStructure.Run();
     if (_rank == 0)
     {
         Dist(vsyncGroup, _dependencyStructure.GetModifiedConfigFiles(),
              _dependencyStructure.GetModifiedCloudMakeConfigFiles());
     }
     else
     {
         vsyncGroup.P2PSend(new Address(_leaders [_partition] [_rank - 1]), CloudManager.RUN_CLOUD_MAKE);
     }
     _dependencyStructure.Reset();
 }
Exemplo n.º 2
0
        private void RunCloudMake(Vsync.Group vsyncGroup)
        {
            Tuple <HashSet <string>, List <RemoteProcessInfo> > processedInfo;
            HashSet <string>         configFiles;
            HashSet <string>         cloudMakeConfigFiles;
            HashSet <string>         activeConfigFiles;
            List <RemoteProcessInfo> processes = null;

            Directory.SetCurrentDirectory(_name);
            _dependencyStructure.Run();
            configFiles          = _dependencyStructure.GetModifiedConfigFiles();
            cloudMakeConfigFiles = _dependencyStructure.GetModifiedCloudMakeConfigFiles();
            CloudManager.WriteLine(_debugFilename, _dependencyStructure.ToString());
            foreach (string cloudMakeConfigFilename in cloudMakeConfigFiles)
            {
                CloudManager.WriteLine(_debugFilename, cloudMakeConfigFilename);
            }
            if (cloudMakeConfigFiles.Count > 1)
            {
                throw new Exception("CloudMakeLocal: There are more than one CloudMake config files.");
            }
            if (cloudMakeConfigFiles.Count == 1)
            {
                processedInfo     = ProcessCloudMakeConfigFile(vsyncGroup);
                activeConfigFiles = processedInfo.Item1;
                processes         = processedInfo.Item2;
                foreach (string activeConfigFile in activeConfigFiles)
                {
                    if (File.Exists(activeConfigFile))
                    {
                        configFiles.Add(activeConfigFile);
                    }
                }
            }
#if DEBUG
            CloudManager.WriteLine(_debugFilename, "Active config files:");
            foreach (string filename in configFiles)
            {
                CloudManager.WriteLine(_debugFilename, filename);
            }
            CloudManager.WriteLine(_debugFilename, "");
            CloudManager.WriteLine(_debugFilename, "Active CloudMake config files:");
            foreach (string filename in cloudMakeConfigFiles)
            {
                CloudManager.WriteLine(_debugFilename, filename);
            }
            CloudManager.WriteLine(_debugFilename, "");
#endif
            foreach (string activeConfigFile in configFiles)
            {
                List <string> fields   = new List <string> (activeConfigFile.Split('/'));
                string        filename = String.Join(Path.DirectorySeparatorChar.ToString(), fields);
                XmlDocument   xmlDoc   = new XmlDocument();

                xmlDoc.Load(filename);
                UpdateConfig(filename, xmlDoc.OuterXml);
            }
            if (cloudMakeConfigFiles.Count == 1)
            {
                foreach (RemoteProcessInfo proc in processes)
                {
                    if (proc.GetAction() == Action.RUN)
                    {
                        RunProcess(proc.GetName(), proc.GetPath(), proc.GetExec(), proc.GetArgs());
                    }
                    else if (proc.GetAction() == Action.KILL)
                    {
                        KillProcess(proc.GetName());
                    }
                }
            }
            _dependencyStructure.Reset();
            Directory.SetCurrentDirectory(_curDirectory);
        }