Beispiel #1
0
        private bool Connect()
        {
            if (_scheduler != null)
            {
                return(true);
            }

            return(HpcLib.TryConnect(Cluster, out _scheduler));
        }
Beispiel #2
0
        /// <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);
        }
Beispiel #3
0
        private bool Connect()
        {
            if (_scheduler != null)
            {
                return(true);
            }

            bool connected = false;

            using (ParallelOptionsScope.Suspend())
            {
                connected = HpcLib.TryConnect(Cluster, out _scheduler);
            }

            return(connected);
        }
Beispiel #4
0
        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);
        }