/// <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>scheduler job</returns> public ISchedulerJob GetV2Job() { ISchedulerJob job; 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); }
/// <summary> /// Connect to HPC /// </summary> /// <param name="schedulerName">scheduler name</param> /// <param name="jobID">job id</param> /// <param name="usernameOrNull">user name</param> /// <param name="jobListener">job listener</param> /// <returns></returns> public static bool TryConnect(string schedulerName, int jobID, string usernameOrNull, out JobListener jobListener) { IScheduler scheduler; ISchedulerJob job; if (HpcLib.TryConnect(schedulerName, out scheduler) && HpcLib.TryGetJob(scheduler, usernameOrNull, jobID, out job)) { jobListener = new JobListener(scheduler, job); return(true); } else { jobListener = null; return(false); } }