StageStatusAsColors(DryadLinqJobStage stage, bool hideCancelled, int staticVertexCount) { int executedVertices = stage.TotalInitiatedVertices; if (hideCancelled) executedVertices -= stage.CancelledVertices; if (executedVertices == 0) yield break; // no colors double unknown = 0; if (staticVertexCount > executedVertices) { unknown = ((double)staticVertexCount - executedVertices) / staticVertexCount; executedVertices = staticVertexCount; } double succesful = stage.SuccessfulVertices / (double)executedVertices; double cancelled = stage.CancelledVertices / (double)executedVertices; double failed = stage.FailedVertices / (double)executedVertices; double invalidated = stage.InvalidatedVertices/(double) executedVertices; double started = stage.StartedVertices / (double)executedVertices; double created = stage.CreatedVertices / (double)executedVertices; double revoked = stage.RevokedVertices/(double) executedVertices; yield return new Tuple<double, Color>(succesful, VertexStateColor(ExecutedVertexInstance.VertexState.Successful)); if (!hideCancelled) yield return new Tuple<double, Color>(cancelled, VertexStateColor(ExecutedVertexInstance.VertexState.Cancelled)); yield return new Tuple<double, Color>(revoked, VertexStateColor(ExecutedVertexInstance.VertexState.Revoked)); yield return new Tuple<double, Color>(invalidated, VertexStateColor(ExecutedVertexInstance.VertexState.Invalidated)); yield return new Tuple<double, Color>(failed, VertexStateColor(ExecutedVertexInstance.VertexState.Failed)); yield return new Tuple<double, Color>(started, VertexStateColor(ExecutedVertexInstance.VertexState.Started)); yield return new Tuple<double, Color>(created, VertexStateColor(ExecutedVertexInstance.VertexState.Created)); yield return new Tuple<double, Color>(unknown, VertexStateColor(ExecutedVertexInstance.VertexState.Unknown)); }
/// <summary> /// Start displaying information about this table. /// </summary> /// <param name="tableinfo">Table information to display.</param> private void SetTable(StaticPartitionedTableInformation tableinfo) { this.EnableStageFiltering(false); this.stageHeaderData.RaiseListChangedEvents = false; this.currentStage = null; this.currentTable = tableinfo; this.tableHeaderData.Clear(); if (this.ShowingStageOrTable != KindOfStageShown.Table) { this.dataGridView_stageHeader.DataSource = this.tableHeaderData; this.dataGridView_stageContents.DataSource = this.tablePartitionsData; // ReSharper disable PossibleNullReferenceException this.dataGridView_stageContents.Columns["PartitionSize"].DefaultCellStyle.Format = "N0"; // ReSharper restore PossibleNullReferenceException this.SetDataGridViewColumnsSize(this.dataGridView_stageContents); this.ShowingStageOrTable = KindOfStageShown.Table; } if (tableinfo.Code != null) { this.textBox_stageCode.Lines = tableinfo.Code; } else { this.textBox_stageCode.Lines = null; } this.label_stage.Text = "Table: " + tableinfo.Header; this.tablePropertyEnumerator.Data = tableinfo; this.tablePropertyEnumerator.PopulateWithProperties(this.tableHeaderData); this.PopulateTablePartitions(); this.stageHeaderData.RaiseListChangedEvents = true; this.stageHeaderData.ResetBindings(); if (tableinfo.Error == "") this.Status("OK", StatusKind.OK); }
/// <summary> /// Start displaying information about this stage. /// </summary> /// <param name="stage">Job stage to display.</param> private void SetStage(DryadLinqJobStage stage) { this.Status("Loading stage " + stage.Name + " information...", StatusKind.LongOp); this.EnableStageFiltering(true); this.stageHeaderData.RaiseListChangedEvents = false; this.currentStage = stage; this.currentTable = null; // stageData is populated by the selectionChanged event handler for the stageHeader if (this.ShowingStageOrTable != KindOfStageShown.Stage) { // if we are changing the nature of the datasource (from table to stage) we need to do some work this.ShowingStageOrTable = KindOfStageShown.Stage; this.dataGridView_stageContents.SuspendLayout(); BindingListSortable<ExecutedVertexInstance> empty = new BindingListSortable<ExecutedVertexInstance>(); // bind to an empty list to make the property changes fast this.dataGridView_stageContents.DataSource = empty; this.dataGridView_stageHeader.DataSource = this.stageHeaderData; this.SetDataGridViewColumnsSize(this.dataGridView_stageHeader); DataGridViewColumnCollection columns = this.dataGridView_stageContents.Columns; // ReSharper disable PossibleNullReferenceException columns["Name"].DisplayIndex = 0; columns["Start"].DefaultCellStyle.Format = "T"; columns["Start"].DisplayIndex = 1; columns["End"].DefaultCellStyle.Format = "T"; columns["End"].DisplayIndex = 2; columns["RunningTime"].DefaultCellStyle.Format = "g"; columns["RunningTime"].DisplayIndex = 3; columns["DataRead"].DefaultCellStyle.Format = "N0"; columns["DataWritten"].DefaultCellStyle.Format = "N0"; string[] invisibleColumns = { "IsManager", /* "ProcessIdentifier",*/ "Number", "WorkDirectory", "ErrorString", "StdoutFile", "LogFilesPattern", "LogDirectory", "UniqueID", "InputChannels", "OutputChannels", "CreationTime", "StartCommandTime", "VertexScheduleTime", "StageName", "DataRead", "DataWritten", "ExitCode", "VertexScheduleTime", "StartCommandTime", "VertexIsCompleted" }; foreach (string s in invisibleColumns) { if (s == "DataRead" || s == "DataWritten") continue; columns[s].Visible = false; } columns["Version"].HeaderText = "v."; this.SetDataGridViewColumnsSize(this.dataGridView_stageContents); // bind to the actual data this.dataGridView_stageContents.DataSource = this.stageData; this.dataGridView_stageContents.ResumeLayout(); } else { this.dataGridView_stageContents.Columns["DataRead"].Visible = true; this.dataGridView_stageContents.Columns["DataWritten"].Visible = true; } // ReSharper restore PossibleNullReferenceException this.stageHeaderData.Clear(); if (this.staticPlan != null) { DryadJobStaticPlan.Stage s = this.staticPlan.GetStageByName(stage.Name); if (s != null) { this.textBox_stageCode.Lines = s.Code; stage.StaticVertexCount = s.Replication; } else { this.textBox_stageCode.Lines = null; } } this.label_stage.Text = "Stage: " + stage.Name; this.stagePropertyEnumerator.Data = stage; this.stagePropertyEnumerator.PopulateWithProperties(this.stageHeaderData); this.stageHeaderData.RaiseListChangedEvents = true; this.stageHeaderData.ResetBindings(); // display by default the work directory of the job manager if nothing is displayed if (stage.Name == "JobManager" && this.comboBox_vertexInformation.Text == "" && Environment.UserName == "jcurrey") { this.comboBox_vertexInformation.Text = "work dir"; } this.Status("OK", StatusKind.OK); }
/// <summary> /// Get information about a particular stage. /// </summary> /// <param name="stagename">Name of stage sought.</param> /// <returns>A description of the stage in question, or null if there are no vertices in that stage.</returns> public DryadLinqJobStage GetStage(string stagename) { if (this.cachedStages.ContainsKey(stagename)) return this.cachedStages[stagename]; List<ExecutedVertexInstance> stageVertices = this.jobVertices.GetStageVertices(stagename); if (stageVertices == null) stageVertices = new List<ExecutedVertexInstance>(); DryadLinqJobStage retval = new DryadLinqJobStage(stagename, stageVertices); this.cachedStages.Add(stagename, retval); return retval; }