示例#1
0
        /// <summary>
        /// Not needed, all summaries are already known.
        /// </summary>
        /// <param name="job">Cluster job.</param>
        /// <returns>Throws an exception.</returns>
        /// <param name="manager">Communication manager.</param>
        public override ClusterJobInformation DiscoverClusterJob(DryadLinqJobSummary job, CommManager manager)
        {
            ClusterConfiguration actual       = (this.Config as CacheClusterConfiguration).ActualConfig(job);
            ClusterStatus        actualStatus = actual.CreateClusterStatus();

            return(actualStatus.DiscoverClusterJob(job, manager));
        }
示例#2
0
        /// <summary>
        /// Refresh the job summary status.
        /// </summary>
        /// <param name="job">Summary to refresh.</param>
        /// <param name="manager">Communication manager.</param>
        public override void RefreshStatus(DryadLinqJobSummary job, CommManager manager)
        {
            ClusterConfiguration actual       = (this.Config as CacheClusterConfiguration).ActualConfig(job);
            ClusterStatus        actualStatus = actual.CreateClusterStatus();

            actualStatus.RefreshStatus(job, manager);
            ClusterJobInformation info = actualStatus.DiscoverClusterJob(job, manager);

            if (info == null)
            {
                job.Status = ClusterJobInformation.ClusterJobStatus.Unknown;
                return;
            }
            job.Status = info.Status;
        }
示例#3
0
文件: JobSummary.cs 项目: xyuan/Dryad
        /// <summary>
        /// Discover the dryadlinq job associated with a cluster job.
        /// </summary>
        /// <param name="status">Cluster configuration.</param>
        /// <returns>The job, if any</returns>
        /// <param name="reporter">Delegate used to report errors.</param>
        public DryadLinqJobSummary DiscoverDryadLinqJob(ClusterStatus status, StatusReporter reporter)
        {
            if (this.IsUnavailable)
            {
                return(null);
            }
            if (this.JobSummary != null)
            {
                return(this.JobSummary);
            }

            DryadLinqJobSummary j = status.DiscoverDryadLinqJobFromClusterJob(this, reporter);

            if (j == null)
            {
                this.IsUnavailable = true;
            }
            return(this.JobSummary = j);
        }
示例#4
0
        /// <summary>
        /// Cancel a job.
        /// </summary>
        /// <param name="jobs">Jobs to cancel.</param>
        /// <param name="cluster">Cluster where the jobs are running.</param>
        /// <returns>True if all cancellations succeed.</returns>
        /// <param name="manager">Communicatoni manager.</param>
        // ReSharper disable once UnusedParameter.Global
        public static bool CancelJobs(IEnumerable<DryadLinqJobSummary> jobs, ClusterStatus cluster, CommManager manager)
        {
            bool done = true;
            foreach (DryadLinqJobSummary job in jobs)
            {
                manager.Token.ThrowIfCancellationRequested();
                if (job.Status != ClusterJobInformation.ClusterJobStatus.Running)
                {
                    manager.Status("Job " + job.Name + " does not appear to be running; will still try to cancel", StatusKind.Error);
                }

                bool success;
                string reason = "";
                try
                {
                    success = cluster.CancelJob(job);
                }
                catch (Exception ex)
                {
                    success = false;
                    reason = ex.Message;
                    Trace.TraceInformation(ex.ToString());
                }

                if (success)
                    manager.Status("Job " + job.Name + " cancelled", StatusKind.OK);
                else
                    manager.Status("Cancellation of " + job.Name + " failed " + reason, StatusKind.Error);
                done &= success;
            }
            return done;
        }
示例#5
0
 /// <summary>
 /// Talk to the web server and build the list of clustr jobs; used it to populate the upper panel.
 /// </summary>
 /// <param name="virtualCluster">Virtual cluster selected; defined only for Scope clusters.</param>
 /// <param name="manager">Communication manager.</param>
 /// <param name="status">Cluster to scan.</param>
 private static List<ClusterJobInformation> BuildClusterJobList(CommManager manager, ClusterStatus status, string virtualCluster)
 {
     return status.GetClusterJobList(virtualCluster, manager).ToList();
 }
示例#6
0
        /// <summary>
        /// Query the cluster again for the list of jobs.
        /// </summary>
        /// <returns>True if the cluster could be found.</returns>
        private void RefreshClusterJobList()
        {
            if (this.cluster == null) return;

            string clus = this.cluster;
            if (!string.IsNullOrEmpty(this.SelectedVirtualCluster))
                clus += "/" + this.SelectedVirtualCluster;
            this.Status("Querying cluster " + clus, StatusKind.LongOp);

            try
            {
                    this.openFromURLToolStripMenuItem.Visible = false;
                if (
                    this.Configuration is CacheClusterConfiguration)
                {
                    this.filteredDataGridView.DataGridView.Columns["VirtualCluster"].Visible = true;
                }
                else
                {
                    this.filteredDataGridView.DataGridView.Columns["VirtualCluster"].Visible = false;
                }
                this.clusterStatus = this.Configuration.CreateClusterStatus();
                this.toolStripMenuItem_job.Enabled = true;

                var item = new BackgroundWorkItem<List<ClusterJobInformation>>(
                    m => BuildClusterJobList(m, this.clusterStatus, this.SelectedVirtualCluster),
                    this.JobListRetrieved,
                    "getJobs");
                this.Queue(item);
            }
            catch (Exception ex)
            {
                this.Status("Cannot retrieve information from cluster " + cluster + ": " + ex.Message, StatusKind.Error);                
                Trace.TraceInformation(ex.ToString());
                this.comboBox_virtualCluster.Text = "";
            }
        }