Example #1
0
        /// <summary>
        /// Compute the colors to draw in a vertex as a function of the stage status.
        /// </summary>
        private void AssignPlanColors()
        {
            // Plans can be colored in two ways: by stage or by vertex status.
            // The stageColorMap is used for the first purpose.
            int stageCount = this.Job.AllStages().Count();

            if (this.stageColorMap == null)
            {
                if (stageCount < PrecomputedColorMap<DryadLinqJobInfo>.MaxColors)
                {
                    this.stageColorMap = new PrecomputedColorMap<DryadLinqJobInfo>(this.Job, stageCount);
                }
                else
                {
                    this.stageColorMap = new HSVColorMap<DryadLinqJobInfo>(this.Job, stageCount);
                }
                this.stageColorMap.DefaultColor = Color.White;

                int index = 0;
                foreach (var stage in this.Job.AllStages().ToList())
                {
                    this.stageColorMap.AddLabelClass(new object[] { stage.Name }, index++, stage.Name);
                }
            }

            if (this.dynamicPlanLayout != null)
            {
                foreach (var node in this.dynamicPlanLayout.AllNodes)
                {
                    DryadLinqJobStage stage = this.Job.GetStage(node.Stage);
                    DryadJobStaticPlan.Stage staticPlanStage = null;
                    if (this.staticPlan != null)
                        staticPlanStage = this.staticPlan.GetStageByName(node.Stage);
                    int staticVertexCount = staticPlanStage != null ? staticPlanStage.Replication : 0;

                    if (this.colorByStagestatusToolStripMenuItem.Checked)
                        node.FillColors = StageStatusAsColors(stage, this.hideCancelledVerticesToolStripMenuItem.Checked, staticVertexCount).ToList();
                    else
                        node.FillColors = new List<Tuple<double, Color>> { new Tuple<double, Color>(1, this.stageColorMap[stage.Name]) };
                }
            }
        }
Example #2
0
 /// <summary>
 /// Refresh the view of the job with the latest information.
 /// </summary>
 private void RefreshDisplay()
 {
     this.Status("Refreshing...", StatusKind.LongOp);
     this.Job.InvalidateCaches();
     this.stageColorMap = null; // force recomputation
     this.RefreshJob();
 }