Пример #1
0
        public void ValidateFinalizeParse()
        {
            Locally locally = new Locally();

            try
            {
                locally.Cleanup = true;
                locally.FinalizeParse();
                ApplicationLog.WriteLine("Locally BVT: Locally FinalizeParse Validated successfully");
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                       "Locally BVT: Locally FinalizeParse Not validated successfully:", ex.Message));
                Assert.Fail("Locally BVT: Locally FinalizeParse Not validated successfully");
            }
        }
Пример #2
0
        public void ValidateDistribute()
        {
            Locally        locally        = new Locally();
            IDistributable idistributable = new CommandApp();

            try
            {
                locally.Cleanup   = true;
                locally.TaskCount = 10;
                locally.Tasks     = new RangeCollection(1, 500);
                locally.Distribute(idistributable);
                ApplicationLog.WriteLine("Locally BVT: Locally Distribute Validated successfully");
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                       "Locally BVT: Locally Distribute not validated successfully:", ex.Message));
                Assert.Fail("Locally BVT: Locally Distribute Not validated successfully");
            }
        }
Пример #3
0
        private static ISchedulerTask AddCleanupTaskToJob(ClusterSubmitterArgs clusterArgs, IScheduler scheduler, ISchedulerJob job, IDistributable distributableJob)
        {
            ISchedulerCollection taskList        = job.GetTaskList(scheduler.CreateFilterCollection(), scheduler.CreateSortCollection(), true);
            IStringCollection    dependencyTasks = scheduler.CreateStringCollection();

            if (!clusterArgs.OnlyDoCleanup)
            {
                dependencyTasks.Add(((ISchedulerTask)taskList[0]).Name);
            }
            ISchedulerTask cleanupTask = CreateCleanupTask(job, clusterArgs.ExternalRemoteDirectoryName, clusterArgs.StdErrRelativeDirName, clusterArgs.StdOutRelativeDirName, "cleanup", isFinalCleanup: true);

            Locally local = new Locally()
            {
                Cleanup         = true,
                TaskCount       = clusterArgs.TaskCount,
                Tasks           = new RangeCollection(),
                ParallelOptions = new ParallelOptions()
                {
                    MaxDegreeOfParallelism = 1
                }
            };

            DistributeApp.Distribute distributeExe = new DistributeApp.Distribute()
            {
                Distributor   = local,
                Distributable = distributableJob
            };

            string exeName = distributableJob is DistributableWrapper ? clusterArgs.ExeName : distributeExe.GetType().Assembly.GetName().Name;

            string taskCommandLine = string.Format("{0}\\{1} {2}", clusterArgs.ExeRelativeDirectoryName, exeName, CreateTaskString(distributeExe, clusterArgs.MinimalCommandLine));

            cleanupTask.CommandLine = taskCommandLine;

            if (!clusterArgs.OnlyDoCleanup)
            {
                cleanupTask.DependsOn = dependencyTasks;
            }
            job.AddTask(cleanupTask);
            return(cleanupTask);
        }
Пример #4
0
        private static string CreateTaskString(DistributeApp.Distribute distributeExe, bool suppressDefaults)
        {
            DistributableWrapper wrapper = distributeExe.Distributable as DistributableWrapper;

            if (wrapper != null)
            {
                Locally local = (Locally)distributeExe.Distributor;

                string result = string.Format("{0} -TaskCount {1} -Tasks {2} -Cleanup {3}",
                                              wrapper.ToString(),
                                              local.TaskCount,
                                              local.Tasks == null ? "*" : local.Tasks.ToString(),
                                              local.Cleanup);

                return(result);
            }
            else
            {
                string result = CommandArguments.ToString(distributeExe, suppressDefaults: true, protectWithQuotes: true);
                result = result.Replace("Tasks:null", "Tasks:*");
                return(result);
            }
        }
Пример #5
0
        private static ISchedulerTask CreateTask(int?taskNumber, ClusterSubmitterArgs clusterArgs, ISchedulerJob job, IDistributable distributableObj, IStringCollection nodesToUse)
        {
            Locally local = new Locally()
            {
                Cleanup   = false,
                TaskCount = clusterArgs.TaskCount,
                Tasks     = taskNumber.HasValue ? new RangeCollection(taskNumber.Value) : null,
            };

            ISchedulerTask task = job.CreateTask();

            if (nodesToUse != null)
            {
                task.RequiredNodes = nodesToUse;
            }
            if (clusterArgs.NumCoresPerTask != null)
            {
                task.MinimumNumberOfCores = clusterArgs.NumCoresPerTask.Value;
                task.MaximumNumberOfCores = clusterArgs.NumCoresPerTask.Value;
                task.MaximumNumberOfNodes = 1;
                local.ParallelOptions.MaxDegreeOfParallelism = clusterArgs.NumCoresPerTask.Value;
            }
            if (!clusterArgs.IsExclusive)
            {
                local.ParallelOptions = new ParallelOptions()
                {
                    MaxDegreeOfParallelism = 1
                };
            }

            task.WorkDirectory = clusterArgs.ExternalRemoteDirectoryName;

            DistributeApp.Distribute distributeExe = new DistributeApp.Distribute()
            {
                Distributable = distributableObj,
                Distributor   = local
            };

            string taskArgString = CreateTaskString(distributeExe, clusterArgs.MinimalCommandLine);
            string exeName       = distributeExe.Distributable is DistributableWrapper ? clusterArgs.ExeName : distributeExe.GetType().Assembly.GetName().Name;

            string taskCommandLine = null;

            if (clusterArgs.UseMPI)
            {
                taskCommandLine = string.Format("mpiexec -n {0} {1}\\{2} {3}", clusterArgs.NumCoresPerTask, clusterArgs.ExeRelativeDirectoryName, exeName, taskArgString);
            }
            else
            {
                taskCommandLine = string.Format("{0}\\{1} {2}", clusterArgs.ExeRelativeDirectoryName, exeName, taskArgString);
            }
            task.CommandLine = taskCommandLine;

            string taskNumberAsString = taskNumber.HasValue ? taskNumber.Value.ToString() : "*";

            task.Name = Helper.CreateDelimitedString(" ", distributableObj.JobName, taskNumberAsString);
            Console.WriteLine(Resource.StdOutRelativeDirName + clusterArgs.StdOutRelativeDirName);
            task.StdErrFilePath = string.Format(@"{0}\{1}.txt", clusterArgs.StdErrRelativeDirName, taskNumberAsString);
            task.StdOutFilePath = string.Format(@"{0}\{1}.txt", clusterArgs.StdOutRelativeDirName, taskNumberAsString);

            Console.WriteLine(Resource.CreateTask, task.CommandLine.Length, task.CommandLine);
            if (task.StdErrFilePath.Length >= 160)
            {
                Console.WriteLine(Resource.Caution, task.StdErrFilePath.Length);
            }

            return(task);
        }