Ejemplo n.º 1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     DeadlineConfig.SetDeadlines();
 }
Ejemplo n.º 2
0
        public void LimitGroupsAreTrimmed()
        {
            var poolConfig = new PoolConfigurationModel {
                ExcludeFromLimitGroups = "limitgroup,  limitgroup2"
            };
            var deadlineConfig = new DeadlineConfig();

            Assert.Equal("limitgroup;limitgroup2", poolConfig.GetDeadlineExcludeFromLimitGroupsString(deadlineConfig));
        }
Ejemplo n.º 3
0
        public void EmptyExcludeFromLimitGroupsReturnsNull()
        {
            var poolConfig = new PoolConfigurationModel {
                ExcludeFromLimitGroups = ""
            };
            var deadlineConfig = new DeadlineConfig();

            Assert.Null(poolConfig.GetDeadlineExcludeFromLimitGroupsString(deadlineConfig));
        }
Ejemplo n.º 4
0
        public void EnvironmentLimitGroupsIsUsedWhenNoPoolLimitGroup()
        {
            var poolConfig = new PoolConfigurationModel {
                ExcludeFromLimitGroups = null
            };
            var envDeadlineConfig = new DeadlineConfig {
                ExcludeFromLimitGroups = "environmentLimitGroup"
            };

            Assert.Equal("environmentLimitGroup", poolConfig.GetDeadlineExcludeFromLimitGroupsString(envDeadlineConfig));
        }
Ejemplo n.º 5
0
        public void PoolLimitGroupsOverrideEnvironment()
        {
            var poolConfig = new PoolConfigurationModel {
                ExcludeFromLimitGroups = "limitgroup"
            };
            var envDeadlineConfig = new DeadlineConfig {
                ExcludeFromLimitGroups = "environmentLimitGroup"
            };

            Assert.Equal("limitgroup", poolConfig.GetDeadlineExcludeFromLimitGroupsString(envDeadlineConfig));
        }
        private async Task AppendDeadlineSetupToStartTask(
            RenderingEnvironment environment,
            string poolName,
            StartTask startTask,
            DeadlineConfig deadlineConfig,
            InstallationPackage deadlinePackage,
            bool isWindows,
            bool useGroups)
        {
            var commandLine   = startTask.CommandLine;
            var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles);

            var startTaskScriptUrl = isWindows
                ? GetWindowsStartTaskUrl(environment)
                : GetLinuxStartTaskUrl(environment);

            var uri      = new Uri(startTaskScriptUrl);
            var filename = uri.AbsolutePath.Split('/').Last();
            var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename);

            resourceFiles.Add(installScriptResourceFile);

            commandLine += $".\\{installScriptResourceFile.FilePath}";

            if (deadlinePackage != null && !string.IsNullOrEmpty(deadlinePackage.Container))
            {
                resourceFiles.Add(GetContainerResourceFile(deadlinePackage.Container, deadlinePackage.PackageName));
                commandLine += $" -installerPath {deadlinePackage.PackageName}";
            }

            if (environment.Domain.JoinDomain)
            {
                commandLine += " -domainJoin";
                commandLine += $" -domainName {environment.Domain.DomainName}";
                commandLine += $" -domainJoinUserName {environment.Domain.DomainJoinUsername}";

                if (!string.IsNullOrWhiteSpace(environment.Domain.DomainWorkerOuPath))
                {
                    commandLine += $" -domainOuPath '{environment.Domain.DomainWorkerOuPath}'";
                }
            }

            if (environment.KeyVaultServicePrincipal != null)
            {
                commandLine += $" -tenantId {environment.KeyVaultServicePrincipal.TenantId}";
                commandLine += $" -applicationId {environment.KeyVaultServicePrincipal.ApplicationId}";
                commandLine += $" -keyVaultCertificateThumbprint {environment.KeyVaultServicePrincipal.Thumbprint}";
                commandLine += $" -keyVaultName {environment.KeyVault.Name}";
            }

            commandLine += $" -deadlineRepositoryPath {deadlineConfig.WindowsRepositoryPath}";

            if (!string.IsNullOrEmpty(deadlineConfig.RepositoryUser))
            {
                commandLine += $" -deadlineRepositoryUserName {deadlineConfig.RepositoryUser}";
            }

            if (!string.IsNullOrEmpty(deadlineConfig.ServiceUser))
            {
                commandLine += $" -deadlineServiceUserName {deadlineConfig.ServiceUser}";
            }
            else
            {
                // If the Deadline slave is running under the start task context (not a service)
                // then we don't want to wait for success as it will block after launching the
                // Deadline launcher to prevent it being killed.
                startTask.WaitForSuccess = false;
            }

            commandLine += $" -deadlineLicenseMode {deadlineConfig.LicenseMode.ToString()}";

            if (!string.IsNullOrEmpty(deadlineConfig.DeadlineRegion))
            {
                commandLine += $" -deadlineRegion {deadlineConfig.DeadlineRegion}";
            }

            if (!string.IsNullOrEmpty(deadlineConfig.LicenseServer))
            {
                commandLine += $" -deadlineLicenseServer {deadlineConfig.LicenseServer}";
            }

            if (useGroups)
            {
                commandLine += $" -deadlineGroups {poolName}";
            }
            else
            {
                commandLine += $" -deadlinePools {poolName}";
            }

            if (!string.IsNullOrWhiteSpace(deadlineConfig.ExcludeFromLimitGroups))
            {
                commandLine += $" -excludeFromLimitGroups '{deadlineConfig.ExcludeFromLimitGroups}'";
            }

            commandLine += ";";

            startTask.CommandLine   = commandLine;
            startTask.ResourceFiles = resourceFiles;
        }
        private void AppendDeadlineSetupToStartTask(
            RenderingEnvironment environment,
            string poolName,
            IEnumerable <string> additionalPools,
            IEnumerable <string> additionalGroups,
            StartTask startTask,
            DeadlineConfig deadlineConfig,
            InstallationPackage deadlinePackage,
            bool isWindows,
            bool useGroups)
        {
            var commandLine   = startTask.CommandLine;
            var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles);

            var startTaskScriptUrl = isWindows
                ? GetWindowsStartTaskUrl(environment)
                : GetLinuxStartTaskUrl(environment);

            var uri      = new Uri(startTaskScriptUrl);
            var filename = uri.AbsolutePath.Split('/').Last();
            var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename);

            resourceFiles.Add(installScriptResourceFile);

            if (isWindows)
            {
                commandLine += $".\\{installScriptResourceFile.FilePath} ";
            }
            else
            {
                commandLine += $"./{installScriptResourceFile.FilePath} ";
            }

            if (deadlinePackage != null && !string.IsNullOrEmpty(deadlinePackage.Container))
            {
                resourceFiles.Add(GetContainerResourceFile(deadlinePackage.Container, deadlinePackage.PackageName));
                commandLine += GetParameterSet(isWindows, "installerPath", deadlinePackage.PackageName);
            }

            if (isWindows & environment.Domain != null && environment.Domain.JoinDomain)
            {
                commandLine += GetParameterSet(isWindows, "domainJoin");
                commandLine += GetParameterSet(isWindows, "domainName", environment.Domain.DomainName);
                commandLine += GetParameterSet(isWindows, "domainJoinUserName", environment.Domain.DomainJoinUsername);

                if (!string.IsNullOrWhiteSpace(environment.Domain.DomainWorkerOuPath))
                {
                    commandLine += GetParameterSet(isWindows, "domainOuPath", environment.Domain.DomainWorkerOuPath);
                }
            }

            if (environment.KeyVaultServicePrincipal != null)
            {
                commandLine += GetParameterSet(isWindows, "tenantId", environment.KeyVaultServicePrincipal.TenantId.ToString());
                commandLine += GetParameterSet(isWindows, "applicationId", environment.KeyVaultServicePrincipal.ApplicationId.ToString());
                commandLine += GetParameterSet(isWindows, "keyVaultCertificateThumbprint", environment.KeyVaultServicePrincipal.Thumbprint);
                commandLine += GetParameterSet(isWindows, "keyVaultName", environment.KeyVault.Name);
            }

            var repoPath = isWindows ? deadlineConfig.WindowsRepositoryPath : deadlineConfig.LinuxRepositoryPath;

            if (!string.IsNullOrWhiteSpace(repoPath))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRepositoryPath", deadlineConfig.WindowsRepositoryPath);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.RepositoryUser))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRepositoryUserName", deadlineConfig.RepositoryUser);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.ServiceUser))
            {
                commandLine += GetParameterSet(isWindows, "deadlineServiceUserName", deadlineConfig.ServiceUser);
            }
            else
            {
                // If the Deadline slave is running under the start task context (not a service)
                // then we don't want to wait for success as it will block after launching the
                // Deadline launcher to prevent it being killed.
                startTask.WaitForSuccess = false;
            }

            if (deadlineConfig.LicenseMode != null)
            {
                commandLine += GetParameterSet(isWindows, "deadlineLicenseMode", deadlineConfig.LicenseMode.ToString());
            }

            if (!string.IsNullOrEmpty(deadlineConfig.DeadlineRegion))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRegion", deadlineConfig.DeadlineRegion);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.LicenseServer))
            {
                commandLine += GetParameterSet(isWindows, "deadlineLicenseServer", deadlineConfig.LicenseServer);
            }

            var pools = useGroups ? "" : poolName;

            if (additionalPools != null && additionalPools.Any())
            {
                pools += string.IsNullOrEmpty(pools) ? "" : ",";
                pools += string.Join(',', additionalPools);
            }

            if (!string.IsNullOrEmpty(pools))
            {
                commandLine += GetParameterSet(isWindows, "deadlinePools", pools);
            }

            var groups = useGroups ? poolName : "";

            if (additionalGroups != null && additionalGroups.Any())
            {
                groups += string.IsNullOrEmpty(groups) ? "" : ",";
                groups += string.Join(',', additionalGroups);
            }

            if (!string.IsNullOrEmpty(groups))
            {
                commandLine += GetParameterSet(isWindows, "deadlineGroups", groups);
            }

            if (!string.IsNullOrWhiteSpace(deadlineConfig.ExcludeFromLimitGroups))
            {
                commandLine += GetParameterSet(isWindows, "excludeFromLimitGroups", deadlineConfig.ExcludeFromLimitGroups);
            }

            commandLine += "; ";

            if (!isWindows)
            {
                commandLine += "wait";
            }

            startTask.CommandLine   = commandLine;
            startTask.ResourceFiles = resourceFiles;
        }
Ejemplo n.º 8
0
        private void AppendDeadlineParamsToStartTask(
            PoolConfigurationModel poolConfiguration,
            RenderingEnvironment environment,
            StartTask startTask,
            DeadlineConfig deadlineConfig,
            InstallationPackage deadlinePackage,
            bool isWindows)
        {
            var commandLine   = startTask.CommandLine;
            var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles);

            if (deadlinePackage != null && !string.IsNullOrEmpty(deadlinePackage.Container))
            {
                resourceFiles.Add(GetContainerResourceFile(deadlinePackage.Container, deadlinePackage.PackageName));
                commandLine += GetParameterSet(isWindows, "installerPath", deadlinePackage.PackageName);
            }

            if (isWindows & environment.Domain != null && environment.Domain.JoinDomain)
            {
                commandLine += GetParameterSet(isWindows, "domainJoin");
                commandLine += GetParameterSet(isWindows, "domainName", environment.Domain.DomainName);
                commandLine += GetParameterSet(isWindows, "domainJoinUserName", environment.Domain.DomainJoinUsername);

                if (!string.IsNullOrWhiteSpace(environment.Domain.DomainWorkerOuPath))
                {
                    commandLine += GetParameterSet(isWindows, "domainOuPath", environment.Domain.DomainWorkerOuPath);
                }
            }

            if (environment.KeyVaultServicePrincipal != null)
            {
                commandLine += GetParameterSet(isWindows, "tenantId", environment.KeyVaultServicePrincipal.TenantId.ToString());
                commandLine += GetParameterSet(isWindows, "applicationId", environment.KeyVaultServicePrincipal.ApplicationId.ToString());
                commandLine += GetParameterSet(isWindows, "keyVaultCertificateThumbprint", environment.KeyVaultServicePrincipal.Thumbprint);
                commandLine += GetParameterSet(isWindows, "keyVaultName", environment.KeyVault.Name);
            }

            var repoPath = isWindows ? deadlineConfig.WindowsRepositoryPath : deadlineConfig.LinuxRepositoryPath;

            if (!string.IsNullOrWhiteSpace(repoPath))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRepositoryPath", deadlineConfig.WindowsRepositoryPath);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.RepositoryUser))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRepositoryUserName", deadlineConfig.RepositoryUser);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.ServiceUser))
            {
                commandLine += GetParameterSet(isWindows, "deadlineServiceUserName", deadlineConfig.ServiceUser);
            }
            else
            {
                // If the Deadline slave is running under the start task context (not a service)
                // then we don't want to wait for success as it will block after launching the
                // Deadline launcher to prevent it being killed.
                startTask.WaitForSuccess = false;
            }

            if (deadlineConfig.LicenseMode != null)
            {
                commandLine += GetParameterSet(isWindows, "deadlineLicenseMode", deadlineConfig.LicenseMode.ToString());
            }

            if (!string.IsNullOrEmpty(deadlineConfig.DeadlineRegion))
            {
                commandLine += GetParameterSet(isWindows, "deadlineRegion", deadlineConfig.DeadlineRegion);
            }

            if (!string.IsNullOrEmpty(deadlineConfig.LicenseServer))
            {
                commandLine += GetParameterSet(isWindows, "deadlineLicenseServer", deadlineConfig.LicenseServer);
            }

            var pools = poolConfiguration.GetDeadlinePoolsString();

            if (!string.IsNullOrEmpty(pools))
            {
                commandLine += GetParameterSet(isWindows, "deadlinePools", pools);
            }

            var groups = poolConfiguration.GetDeadlineGroupsString();

            if (!string.IsNullOrEmpty(groups))
            {
                commandLine += GetParameterSet(isWindows, "deadlineGroups", groups);
            }

            var limitGroups = poolConfiguration.GetDeadlineExcludeFromLimitGroupsString(deadlineConfig);

            if (!string.IsNullOrWhiteSpace(limitGroups))
            {
                commandLine += GetParameterSet(isWindows, "excludeFromLimitGroups", limitGroups);
            }

            commandLine += "; ";

            if (!isWindows)
            {
                commandLine += "wait";
            }

            startTask.CommandLine   = commandLine;
            startTask.ResourceFiles = resourceFiles;
        }
Ejemplo n.º 9
0
        public static string GetDeadlineExcludeFromLimitGroupsString(this PoolConfigurationModel poolConfiguration, DeadlineConfig deadlineConfig)
        {
            if (poolConfiguration == null)
            {
                return(null);
            }

            // Get pool limit groups, or environment limitgroups, if specified.
            var limitgroups = !string.IsNullOrWhiteSpace(poolConfiguration.ExcludeFromLimitGroups)
                ? poolConfiguration.ExcludeFromLimitGroups
                : deadlineConfig != null && !string.IsNullOrWhiteSpace(deadlineConfig.ExcludeFromLimitGroups) ? deadlineConfig.ExcludeFromLimitGroups : null;

            if (!string.IsNullOrWhiteSpace(limitgroups))
            {
                var trimmed = limitgroups
                              .Split(',', StringSplitOptions.RemoveEmptyEntries)
                              .Select(lg => lg.Trim());

                if (trimmed.Any())
                {
                    // Multiple limit groups are separated by a space
                    return(string.Join(';', trimmed));
                }
            }

            return(null);
        }