private void LoadUsers() { var list = new List <User>(); using (var session = App.SessionFactory.OpenSession()) { using (var tx = session.BeginTransaction()) { try { list = session.Query <User>().ToList(); tx.Commit(); } catch (Exception) { tx.Rollback(); throw; } } } UserList = new BindingListSortable <UserModel>(Bootstrapper.Mapper.Map <List <User>, List <UserModel> >(list)); }
/// <summary> /// Initialize a job browser for a specified job. /// </summary> /// <param name="job">Job to display.</param> public JobBrowser(DryadLinqJobInfo job) { this.doingStartup = true; this.InitializeComponent(); this.queueWorker = new BackgroundWorker(); this.queue = new BackgroundWorkQueue(this.queueWorker, this.toolStripStatusLabel_currentWork, this.toolStripStatusLabel_backgroundWork); this.WarnedAboutDebugging = false; this.status = new StatusWriter(this.toolStripStatusLabel, this.statusStrip, this.Status); this.refreshTimer = new System.Windows.Forms.Timer(); this.refreshTimer.Interval = 30000; // 30 seconds this.refreshTimer.Tick += this.refreshTimer_Tick; #region SET_JOB_HEADER this.jobHeaderData = new BindingListSortable<PropertyEnumerator<DryadLinqJobInfo>.PropertyValue>(); this.dataGridView_jobHeader.DataSource = this.jobHeaderData; this.SetDataGridViewColumnsSize(this.dataGridView_jobHeader); this.jobPropertyEnumerator = new PropertyEnumerator<DryadLinqJobInfo>(); this.jobPropertyEnumerator.ValueFormatter = this.PropertyValueFormatter; List<string> jobPropertiesToSkip = new List<string> { "ClusterConfiguration", "Processes", "Vertices", "JM", "Name", "JobManagerVertex", "JMStdoutIncomplete", "JobInfoCannotBeCollected" }; this.jobPropertyEnumerator.Skip(jobPropertiesToSkip); this.jobPropertyEnumerator.Expand("Summary"); #endregion #region SET_STAGE_HEADER this.stageHeaderData = new BindingListSortable<PropertyEnumerator<DryadLinqJobStage>.PropertyValue>(); this.stagePropertyEnumerator = new PropertyEnumerator<DryadLinqJobStage>(); this.stagePropertyEnumerator.ValueFormatter = this.PropertyValueFormatter; List<string> stagePropertiesToSkip = new List<string> { "Vertices", "Name" }; this.stagePropertyEnumerator.Skip(stagePropertiesToSkip); this.tableHeaderData = new BindingListSortable<PropertyEnumerator<StaticPartitionedTableInformation>.PropertyValue>(); this.tablePropertyEnumerator = new PropertyEnumerator<StaticPartitionedTableInformation>(); this.tablePropertyEnumerator.ValueFormatter = this.PropertyValueFormatter; this.tablePropertyEnumerator.Skip("Partitions", "Header", "Code"); this.SetNoStageOrTable("", false); #endregion #region SET_STAGE_DATA this.stageData = new BindingListSortable<ExecutedVertexInstance>(); this.tablePartitionsData = new BindingListSortable<StaticPartitionedTableInformation.StaticPartitionInformation>(); #endregion #region SET_VERTEX_HEADER this.vertexHeaderData = new BindingListSortable<PropertyEnumerator<ExecutedVertexInstance>.PropertyValue>(); this.dataGridView_vertexHeader.DataSource = this.vertexHeaderData; this.SetDataGridViewColumnsSize(this.dataGridView_vertexHeader); this.vertexPropertyEnumerator = new PropertyEnumerator<ExecutedVertexInstance>(); this.vertexPropertyEnumerator.ValueFormatter = this.PropertyValueFormatter; List<string> vertexPropertiesToSkip = new List<string> { "JobSummary", "InputChannels", "OutputChannels", "Name", "LogFilesPattern", "IsManager" }; this.vertexPropertyEnumerator.Skip(vertexPropertiesToSkip); #endregion // Disable the vertex context menu, since none of these operatios work at this point this.contextMenu_stageVertex.Enabled = false; this.plansHaveBeenBuilt = false; this.graphViewer = new Msagl.GraphViewerGdi.GViewer(); this.graphViewer.Dock = DockStyle.Fill; this.graphViewer.NavigationVisible = false; this.graphViewer.ToolBarIsVisible = false; this.graphViewer.MouseClick += this.graphViewer_MouseClick; this.graphViewer.MouseDoubleClick += this.graphViewer_MouseDoubleClick; this.graphViewer.InsertingEdge = false; this.staticGraphZoomLevel = 0; this.planDrawSurface = new DrawingSurface2D(this.panel_jobSchedule); this.planDrawSurface.SetMargins(4, 4, 4, 4); this.panel_jobSchedule.MouseDoubleClick += this.panel_jobSchedule_MouseDoubleClick; this.planDrawSurface.FastDrawing = false; this.colorByStagestatusToolStripMenuItem.Checked = true; this.defaultBackColor = this.label_job.BackColor; this.planVisible = PlanVisible.None; this.linkCache = new Dictionary<string, IClusterResidentObject>(); this.mouseIsHeld = false; this.draggingMouse = false; this.drawingSurfaceSize = 0.0; #region TOOLTIPS ToolTip help = new ToolTip(); help.SetToolTip(this.richTextBox_file, "Click on links to follow; control-click to open in explorer; alt-click to follow an input channel to its source."); help.SetToolTip(this.panel_scheduleContainer, "Displays the job schedule; click to select."); help.SetToolTip(this.checkBox_refresh, "Refreshes the job status ever 30s."); help.SetToolTip(this.graphViewer, "Click to select stages; Ctrl +/- to zoom."); help.SetToolTip(this.dataGridView_jobHeader, "Selecting some rows filters the data."); help.SetToolTip(this.comboBox_plan, "Display the job plan in various forms."); help.SetToolTip(this.comboBox_vertexInformation, "Display more information about the vertex."); help.SetToolTip(this.label_job, "Global job information."); help.SetToolTip(this.label_stage, "Information about the selected stage/table. Select rows for filtering."); help.SetToolTip(this.label_Vertex, "Information about the selected vertex."); help.SetToolTip(this.panel_jobSchedule, "Click on the stages or tables for more information; drag to zoom."); help.SetToolTip(this.textBox_stageCode, "Code executed by the selected stage."); help.SetToolTip(this.textBox_find, "Type a string to find."); help.SetToolTip(this.button_clearFind, "Stop finding."); help.SetToolTip(this.button_filter, "Show only lines matching string to find (case-sensitive)."); help.SetToolTip(this.button_findNext, "Find next occurence of string."); help.SetToolTip(this.button_findPrev, "Find previous occurence of string."); help.SetToolTip(this.label_title, "File currently displayed."); #endregion this.Job = job; }
/// <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> /// Create an empty DGVData object. /// </summary> public DGVData() { this.visibleItems = new BindingListSortable <T>(); this.dataItems = new List <T>(); this.OnChanged(); }