/// <summary> /// Calls the corresponding Submit function, but waits for the cluster to Finish, Fail, or be Canceled. If the final state is /// Finished, returns silently. Otherwise, it throws and Exception. For a description of the other parameters, see Submit(). /// *** NOTE: ONLY WORKS WITH V2 CLUSTERS. **** /// </summary> public static ClusterSubmitterArgs SubmitAndWait(ArgumentCollection argumentCollection, int maxSubmitAfterTasksFail = 0) { if (argumentCollection.PeekOptional <string>("cluster", "help").Equals("help", StringComparison.CurrentCultureIgnoreCase)) { Console.WriteLine(""); Console.WriteLine(HelpMessage); return(null); } ClusterSubmitterArgs clusterArgs = new ClusterSubmitterArgs(argumentCollection); SubmitAndWait(clusterArgs, argumentCollection, maxSubmitAfterTasksFail); return(clusterArgs); }
/// <summary> /// Submits the ArgumentCollection to the cluster, telling the cluster to run whichever exe is currently running using a new set of args that divids the work up in to tasks. /// IMPORTANT: For this to work, the calling exe needs to except two OPTIONAL args: /// 1) -TaskCount n which tells the exe how many pieces to divide the work in to /// 2) -Tasks i which tells the exe which piece that instance is in change of. Submit() will create TaskCount instances of the exe and do a parameter sweek on Tasks /// For the complete list of optional and required args, see the HelpString. /// </summary> /// <param name="argumentCollection">The set of args, including the args for the exe and the args for the cluster submission, all of which are encoded as optional args (though some are required) /// check to see if this job should actually be submitted (if so, return true, otherwise, false). This is useful to see if the results are already computed and if a completedRows /// file should be made into a skipFile automatically. See PhyloDMain.cs for an example. Note that the out parameter is the ArgumentCollection that will actually be used to run the jobs. /// This is so the function can add in a new SkipFile parameter if needed. Also, be careful: often times checking to see if you need a skipFile requires reading arguments from /// the input args, which will modify that object. Your first step should be to Clone args and asign the result to argsToUseWithPossiblyUpdatedSkipFile.</param> public static ClusterSubmitterArgs Submit(ArgumentCollection argumentCollection) { if (argumentCollection.PeekOptional <string>("cluster", "help").Equals("help", StringComparison.CurrentCultureIgnoreCase)) { Console.WriteLine(""); Console.WriteLine(ArgumentCollection.CreateHelpMessage(typeof(ClusterSubmitterArgs), includeDateStamp: false)); return(null); } ClusterSubmitterArgs clusterArgs = new ClusterSubmitterArgs(argumentCollection); Submit(clusterArgs, argumentCollection); return(clusterArgs); }