public void FinalizeParse() { Helper.CheckCondition <ParseException>(NodeExclusionList.Count == 0 || Version == 2 || Version == 3, "-nodeExclusionList is only supported for API level 1"); Helper.CheckCondition <ParseException>(Version == 1 || Version == 2 || Version == 3, "Only Version 1 or 2 or 3 is supported."); Helper.CheckCondition <ParseException>(TaskCount > 0, "You must specify a positive task count using -TaskCount"); Helper.CheckCondition <ParseException>(Cluster != null, "You must specify a cluster name using -cluster name"); if (Dir == null) { Dir = Environment.CurrentDirectory; string username = HpcLib.GetCurrentUsername(); Dir = username + Dir.Substring(2); // first 2 characters are the drive. e.g. D: RelativeDir = true; } if (ExeName == null) { ExeName = SpecialFunctions.GetEntryOrCallingAssembly().GetName().Name; } if (UsePasswordHack) { Password = HpcLib.GetPassword(out Username); } if (Name == null) { Name = ExeName; } if (Cluster.Equals(":auto:", StringComparison.CurrentCultureIgnoreCase) || Cluster.Equals("$auto$", StringComparison.CurrentCultureIgnoreCase)) { Cluster = HpcLib.GetMostAppropriateCluster(TaskCount).Cluster; } }
public override void Distribute(Distribute.IDistributable distributableObject) { ClusterSubmitter.SubmitAndWait(this, distributableObject, MaxSubmitAfterTasksFail); if (CopyResults.Count > 0) { HpcLib.CopyFiles(CopyResults, ExternalRemoteDirectoryName, "."); } }
private bool Connect() { if (_scheduler != null) { return(true); } return(HpcLib.TryConnect(Cluster, out _scheduler)); }
/// <summary> /// Attempts to connect the the scheduler specified by Cluster and retrieve the Job specified by JobID. Will throw a SchedulerException if either of those fails. /// </summary> /// <returns></returns> public v2.ISchedulerJob GetV2Job() { v2.ISchedulerJob job; v2.IScheduler scheduler; HpcLib.TryConnect(Cluster, out scheduler).Enforce <SchedulerException>("Unable to connect to head node {0}", Cluster); HpcLib.TryGetJob(scheduler, Username, JobID, out job).Enforce <SchedulerException>("Unable to load jobID {0} for user {1}", JobID, Username); return(job); }
private bool Connect() { if (_scheduler != null) { return(true); } bool connected = false; using (ParallelOptionsScope.Suspend()) { connected = HpcLib.TryConnect(Cluster, out _scheduler); } return(connected); }
public static void CopyInputFiles(List <string> filesToCopy, string baseDestnDir) { HpcLib.CopyFiles(filesToCopy, "", baseDestnDir); //string xcopyArgsFormatString = GetXCopyArgsFormatString(filesToCopy[0], baseDestnDir); //foreach (string file in filesToCopy) //{ // Process proc = new Process(); // proc.StartInfo.FileName = "xcopy"; // proc.StartInfo.Arguments = string.Format(xcopyArgsFormatString, file); // proc.StartInfo.UseShellExecute = false; // //proc.StartInfo.RedirectStandardOutput = true; // //Console.WriteLine("xcopy " + proc.StartInfo.Arguments); // proc.Start(); // proc.WaitForExit(); // if (proc.ExitCode > 0) // throw new Exception("Unable to copy file using command xcopy " + proc.StartInfo.Arguments); //} }
private ISchedulerJob GetJob() { lock (_getJobLocker) { HpcLib.TryGetJob(_scheduler, ClusterArgs.Username, ClusterArgs.JobID, out _job); return(_job); } //IFilterCollection filter = _scheduler.CreateFilterCollection(); //filter.Add(FilterOperator.Equal, PropId.Job_Name, ClusterArgs.RunName); //IIntCollection potentialIDs = _scheduler.GetJobIdList(filter, null); //var matchingIDs = potentialIDs.Where(id => id == ClusterArgs.JobID); //if (matchingIDs.Count() == 1) //{ // int id = matchingIDs.First(); // ISchedulerJob job = _scheduler.OpenJob(id); // return job; //} //return null; }
private static void CopyExes(ClusterSubmitterArgs clusterArgs) { //!! why was this removed?? //var lockObj = CCSLibSettings.KnownClusters[clusterArgs.Cluster]; // use an object that is specific to this cluster. //lock (lockObj) // we should only have one thread trying to copy to the cluster at a time. Esp since copying is smart and will reuse identical exes if they're already there. { if (true || clusterArgs.ExeRelativeDirectoryName == null) { clusterArgs.ExeRelativeDirectoryName = HpcLib.CopyExesToCluster(clusterArgs.ExternalRemoteDirectoryName, clusterArgs.Name); } else { Console.WriteLine("Using exe directory specified by user: "******"\\" + clusterArgs.ExeRelativeDirectoryName; Helper.CheckCondition(Directory.Exists(absoluteExeDir), "Directory {0} does not exist!", absoluteExeDir); //string exeRelativeName = "exes\\" + clusterArgs.ExeRelativeDirectoryName; //clusterArgs.ExeRelativeDirectoryName = "\"" + exeRelativeName + "\""; } } }
private static Timer HeartbeatTimer(int jobID, string clusterName, JobWaitingParams jobWaitingParams, int heartBeatPeriod) { Timer timer = new Timer(state => { try { jobWaitingParams.Job.Refresh(); //Console.WriteLine("Job is still connected. Status is " + jobWaitingParams.JobState); } catch { Console.WriteLine("Lost connection to job. Attempting reconnect."); v2008R2.IScheduler scheduler = null; for (int iTry = 0; iTry < 10 && scheduler == null; iTry++) { HpcLib.TryConnect(clusterName, out scheduler); } if (scheduler == null) { Console.WriteLine("Unable to reconnect to cluster. Going back to sleep."); } else { jobWaitingParams.Job = scheduler.OpenJob(jobID); jobWaitingParams.Job.Refresh(); SetupJobEventHandler(jobWaitingParams); Console.WriteLine("Reconnect succeeded."); } } jobWaitingParams.JobState = jobWaitingParams.Job.State; if (JobIsFinished(jobWaitingParams.Job.State)) { jobWaitingParams.ManualResetEvent.Set(); } }, null, heartBeatPeriod, heartBeatPeriod); return(timer); }