private static v1.IJob CreateJobApi1(v1.ICluster cluster, v1.JobPriority priority, v1.ITask task, string runName) { v1.IJob job = cluster.CreateJob(); job.Name = runName; // Helper.CreateDelimitedString(" ", runName, firstPieceIndex + "-" + lastPieceIndex); Helper.CheckCondition(job.Name.Length < 80, "Job name is too long. Must be < 80 but is " + job.Name.Length + ". " + job.Name); Console.Write("\r" + job.Name); job.AddTask(task); job.Runtime = task.Runtime; job.IsExclusive = false; job.MinimumNumberOfProcessors = 1; job.MaximumNumberOfProcessors = 1; job.Priority = priority; return(job); }
//private static string GetXCopyArgsFormatString(string exampleFileToCopy, string baseDestnDir) //{ // string relativeDirName = FileUtils.GetDirectoryName(exampleFileToCopy); // string outputDir = Path.Combine(baseDestnDir, relativeDirName); // if(!Directory.Exists(outputDir)) // Directory.CreateDirectory(outputDir); // string args = "/d /c /i \"{0}\" \"" + outputDir + "\""; // return args; //} //private static List<string> GetExclusionNodes(string nodeExclusionList, int apiLevel) //{ // List<string> nodesToExclude = new List<string>(); // if (null != nodeExclusionList) // { // throw new Exception("never managed to get this to work"); // if (apiLevel == 1) throw new Exception("cannot use -nodeExclusionList with version 1 API"); // nodesToExclude = nodeExclusionList.Split(',').ToList(); // } // return nodesToExclude; //} private static void SetPriority(ArgumentCollection argumentCollection, int apiLevel, out v1.JobPriority priorityV1, out v2008R2.Properties.JobPriority priorityV2) { priorityV1 = v1.JobPriority.Normal; priorityV2 = v2008R2.Properties.JobPriority.Normal; switch (apiLevel) { case 1: priorityV1 = argumentCollection.ExtractOptional <v1.JobPriority>("priority", v1.JobPriority.Normal); break; case 2: priorityV2 = argumentCollection.ExtractOptional <v2008R2.Properties.JobPriority>("priority", v2008R2.Properties.JobPriority.Normal); break; default: throw new NotSupportedException(string.Format("Cluster version {0} is not supported.", apiLevel)); } }