Пример #1
0
        /// <summary>
        ///     Distributes the update to all hosts.
        /// </summary>
        /// <param name="partialForge">Partial forge instance.</param>
        public void DistributeUpdate(ForgeComponent partialForge)
        {
            //stamp partial update to ensure all partial updates are kept in the dgraph update folder until baseline update run
            var stampedName    = partialForge.StampPartialUpdate();
            var updateFileName = Path.Combine(partialForge.OutputDirectory, stampedName);
            //get forge host
            var forgeHost = _app.Hosts[partialForge.HostId];

            var copyOps = new List <HostOperation>();

            foreach (var dgraph in _hostDgraphs)
            {
                var dgraph1 = dgraph;
                //find dgraph host
                var dgraphHost = _app.Hosts[dgraph1.HostId];

                // Update was already created on the Partial Forge hosts,
                // so we'll copy update only to the remote hosts
                if (forgeHost.EacHostName == dgraphHost.EacHostName)
                {
                    continue;
                }

                var token = EacGateway.Instance.StartCopyFiles(_app.AppId, forgeHost.HostId, updateFileName,
                                                               dgraph.HostId,
                                                               dgraph.UpdateDir, false);
                copyOps.Add(new HostOperation(dgraph.HostId, token, null));
                Logger.Debug(String.Format("Started copy operation on host {0}. Token: {1}.", dgraph.HostId, token));
            }
            //Wait until all operations finish
            WaitComplete(copyOps);
        }
Пример #2
0
 public static ForgeComponent CreateForgeComponent(ApplicationType appType, ForgeComponentType forge)
 {
     var ht = GetHost(appType, forge.hostID);
     var component = new ForgeComponent(forge.componentID, appType.applicationID, ht)
         {
             OutputDirectory = ResolveRelativePath(forge.workingDir, forge.outputDir),
             InputDirectory = ResolveRelativePath(forge.workingDir, forge.inputDir),
             LogDir = ResolveRelativePath(forge.workingDir, Path.GetDirectoryName(forge.logFile)),
             WorkingDir = forge.workingDir,
             DataPrefix = forge.outputPrefixName
         };
     LoadCustomProperties(component, forge);
     return component;
 }
Пример #3
0
        public static ForgeComponent CreateForgeComponent(ApplicationType appType, ForgeComponentType forge)
        {
            var ht        = GetHost(appType, forge.hostID);
            var component = new ForgeComponent(forge.componentID, appType.applicationID, ht)
            {
                OutputDirectory = ResolveRelativePath(forge.workingDir, forge.outputDir),
                InputDirectory  = ResolveRelativePath(forge.workingDir, forge.inputDir),
                LogDir          = ResolveRelativePath(forge.workingDir, Path.GetDirectoryName(forge.logFile)),
                WorkingDir      = forge.workingDir,
                DataPrefix      = forge.outputPrefixName
            };

            LoadCustomProperties(component, forge);
            return(component);
        }
Пример #4
0
        private static void RunForge(EndecaApplication app, ForgeComponent forge)
        {
            Logger.Info("Getting forge configs ...");
            EacGateway.Instance.StartScript(app.AppId, "ForgeConfigUpdate");

            Logger.Info("Forging...");
            forge.ArchiveLog(true);
            forge.CleanDirs();
            forge.Run();

            if (forge.IsFailed)
            {
                throw new ControlScriptException(forge.FailureMessage);
            }
        }
Пример #5
0
        /// <summary>
        ///     Distributes the update to all hosts.
        /// </summary>
        /// <param name="partialForge">Partial forge instance.</param>
        public void DistributeUpdate(ForgeComponent partialForge)
        {
            //stamp partial update to ensure all partial updates are kept in the dgraph update folder until baseline update run
            var stampedName = partialForge.StampPartialUpdate();
            var updateFileName = Path.Combine(partialForge.OutputDirectory, stampedName);
            //get forge host
            var forgeHost = _app.Hosts[partialForge.HostId];

            var copyOps = new List<HostOperation>();
            foreach (var dgraph in _hostDgraphs)
            {
                var dgraph1 = dgraph;
                //find dgraph host
                var dgraphHost = _app.Hosts[dgraph1.HostId];

                // Update was already created on the Partial Forge hosts,
                // so we'll copy update only to the remote hosts
                if (forgeHost.EacHostName == dgraphHost.EacHostName) continue;

                var token = EacGateway.Instance.StartCopyFiles(_app.AppId, forgeHost.HostId, updateFileName,
                                                               dgraph.HostId,
                                                               dgraph.UpdateDir, false);
                copyOps.Add(new HostOperation(dgraph.HostId, token, null));
                Logger.Debug(String.Format("Started copy operation on host {0}. Token: {1}.", dgraph.HostId, token));
            }
            //Wait until all operations finish
            WaitComplete(copyOps);
        }