Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/08/11 14:54:17 (14 years ago)
Author:
cneumuel
Message:

#1233

  • updated jobstates documentation
  • enhanced ganttChart
  • fixed setting of jobstates
  • added option to force lifecycle-trigger (mainly for testing purposes)
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager
Files:
1 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/GanttChart.Designer.cs

    r5597 r5636  
    1 namespace HeuristicLab.Clients.Hive.Views.ExperimentManager {
     1namespace HeuristicLab.Clients.Hive.Views {
    22  partial class GanttChart {
    33    /// <summary>
     
    4444      series1.ChartArea = "ChartArea1";
    4545      series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.RangeBar;
     46      series1.CustomProperties = "DrawingStyle=Cylinder";
    4647      series1.IsVisibleInLegend = false;
    4748      series1.Legend = "Legend";
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/GanttChart.cs

    r5597 r5636  
    22using System.Collections.Generic;
    33using System.Drawing;
     4using System.Linq;
    45using System.Windows.Forms;
    56using System.Windows.Forms.DataVisualization.Charting;
    67
    7 namespace HeuristicLab.Clients.Hive.Views.ExperimentManager {
     8namespace HeuristicLab.Clients.Hive.Views {
    89  public partial class GanttChart : UserControl {
    910
    1011    private IDictionary<string, Color> categories = new Dictionary<string, Color>();
     12    private IDictionary<string, int> rowNames = new Dictionary<string, int>();
    1113
    1214    public GanttChart() {
     
    1921    }
    2022
    21     public void AddData(int id, string category, DateTime start, DateTime end, string tooltip, bool showLabel = true) {
    22       var point = CreateDataPoint(id, start, end, showLabel ? category : string.Empty, categories[category]);
     23    public void AddData(string rowName, string category, DateTime start, DateTime end, string tooltip, bool showLabel = true) {
     24      AddRowName(rowName);
     25      var point = CreateDataPoint(rowNames[rowName], rowName, start, end, showLabel ? category : string.Empty, categories[category]);
    2326      point.ToolTip = tooltip;
    2427      chart.Series[0].Points.Add(point);
    2528    }
    2629
    27     private static DataPoint CreateDataPoint(double x, DateTime start, DateTime end, string text, Color color) {
     30    private void AddRowName(string rowName) {
     31      if (!rowNames.ContainsKey(rowName)) {
     32        int nextId = rowNames.Count == 0 ? 1 : rowNames.Values.Max() + 1;
     33        rowNames.Add(rowName, nextId);
     34      }
     35    }
     36
     37    private static DataPoint CreateDataPoint(double x, string axisLabel, DateTime start, DateTime end, string text, Color color) {
    2838      var point = new DataPoint(x, new double[] { start.ToOADate(), end.ToOADate() });
    2939      point.Color = color;
    3040      point.Label = text;
     41      point.AxisLabel = axisLabel;
    3142      return point;
    3243    }
     
    3647      categories.Clear();
    3748      chart.Legends[0].CustomItems.Clear();
     49      rowNames.Clear();
    3850    }
    3951  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs

    r5597 r5636  
    135135          this.exceptionTextBox.Text = Content.Job.CurrentStateLog.Exception;
    136136          if (Content.OptimizerJob.ComputeInParallel) {
    137             this.stateLogViewHost.Content = new ItemList<StateLogItemList>(
    138                 this.Content.ChildHiveJobs.Select(child => new StateLogItemList(child.Job.StateLog.Select(x => new StateLogItem(x)))
     137            this.stateLogViewHost.Content = new ItemList<StateLogList>(
     138                this.Content.ChildHiveJobs.Select(child => new StateLogList(child.Job.StateLog)
    139139              ));
    140140          } else {
    141             this.stateLogViewHost.Content = new StateLogItemList(Content.Job.StateLog.Select(x => new StateLogItem(x)));
     141            this.stateLogViewHost.Content = new StateLogList(Content.Job.StateLog);
    142142          }
    143143        } else {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartListView.cs

    r5597 r5636  
    2020#endregion
    2121
     22using System;
    2223using System.Drawing;
     24using System.Linq;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Core.Views;
    2527using HeuristicLab.MainForm;
    26 using HeuristicLab.Services.Hive.Common.DataTransfer;
    2728
    2829namespace HeuristicLab.Clients.Hive.Views {
    2930  [View("StateLogGanttChartList View")]
    30   [Content(typeof(IItemList<StateLogItemList>), IsDefaultView = true)]
     31  [Content(typeof(IItemList<StateLogList>), IsDefaultView = true)]
    3132  public sealed partial class StateLogGanttChartListView : ItemView {
    32     public new IItemList<StateLogItemList> Content {
    33       get { return (IItemList<StateLogItemList>)base.Content; }
     33    public new IItemList<StateLogList> Content {
     34      get { return (IItemList<StateLogList>)base.Content; }
    3435      set { base.Content = value; }
    3536    }
     
    6162        // Add code when content has been changed and is not null
    6263        ganttChart.Reset();
    63         ganttChart.AddCategory(JobState.Offline.ToString(), Color.Brown);
    64         ganttChart.AddCategory(JobState.Waiting.ToString(), Color.Yellow);
    65         ganttChart.AddCategory(JobState.Transferring.ToString(), Color.Blue);
    66         ganttChart.AddCategory(JobState.Calculating.ToString(), Color.Green);
    67         ganttChart.AddCategory(JobState.Finished.ToString(), Color.DarkGreen);
    68         ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange);
    69         ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red);
     64        SetupCategories(ganttChart);
     65
     66        DateTime maxValue = Content.Max(x => x.Max(y => y.DateTime));
     67        var upperLimit = DateTime.FromOADate(Math.Min(DateTime.Now.AddSeconds(10).ToOADate(), maxValue.AddSeconds(10).ToOADate()));
    7068
    7169        for (int i = 0; i < Content.Count; i++) {
    7270          for (int j = 0; j < Content[i].Count - 1; j++) {
    73             string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i][j].State, Content[i][j].DateTime, Content[i][j+1].DateTime);
    74             if (!string.IsNullOrEmpty(Content[i][j].Exception))
    75               tooltip += "\n" + Content[i][j].Exception;
    76             ganttChart.AddData(i + 1, Content[i][j].State.ToString(), Content[i][j].DateTime, Content[i][j + 1].DateTime, tooltip, false);
     71            if(Content[i][j].State != JobState.Offline && Content[i][j].State != JobState.Finished)
     72              AddData(ganttChart, i.ToString(), Content[i][j], Content[i][j+1], upperLimit);
     73          }
     74          if(Content[i].Count > 0) {
     75            AddData(ganttChart, i.ToString(), Content[i][Content[i].Count - 1], null, upperLimit);
    7776          }
    7877        }
     
    8079    }
    8180
     81    public static void SetupCategories(GanttChart ganttChart) {
     82      ganttChart.AddCategory(JobState.Offline.ToString(), Color.Gainsboro);
     83      ganttChart.AddCategory(JobState.Waiting.ToString(), Color.NavajoWhite);
     84      ganttChart.AddCategory(JobState.Transferring.ToString(), Color.CornflowerBlue);
     85      ganttChart.AddCategory(JobState.Calculating.ToString(), Color.DarkGreen);
     86      ganttChart.AddCategory(JobState.Finished.ToString(), Color.White);
     87      ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange);
     88      ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red);
     89    }
     90
     91    //private void AddData(int i, int j, DateTime upperLimit) {
     92    //  DateTime until = j < Content[i].Count - 1 ? Content[i][j + 1].DateTime : upperLimit;
     93    //  TimeSpan duration = until - Content[i][j].DateTime;
     94    //  string tooltip = string.Format("State: {0}\nDuration: {1}\n{2} - {3}", Content[i][j].State, Content[i][j].DateTime, duration, until);
     95    //  if (!string.IsNullOrEmpty(Content[i][j].Exception))
     96    //    tooltip += "\n" + Content[i][j].Exception;
     97    //  ganttChart.AddData(i + 1, Content[i][j].State.ToString(), Content[i][j].DateTime, until, tooltip, false);
     98    //}
     99
     100    public static void AddData(GanttChart ganttChart, string name, StateLog from, StateLog to, DateTime upperLimit) {
     101      DateTime until = to != null ? to.DateTime : upperLimit;
     102      TimeSpan duration = until - from.DateTime;
     103      string tooltip = string.Format("State: {0}\nDuration: {1}\n{2} - {3}", from.State, from.DateTime, duration, until);
     104      if (!string.IsNullOrEmpty(from.Exception))
     105        tooltip += "\n" + from.Exception;
     106      ganttChart.AddData(name, from.State.ToString(), from.DateTime, until, tooltip, false);
     107    }
     108   
    82109    protected override void SetEnabledStateOfControls() {
    83110      base.SetEnabledStateOfControls();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartListView.designer.cs

    r5597 r5636  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.ganttChart = new HeuristicLab.Clients.Hive.Views.ExperimentManager.GanttChart();
     26      this.ganttChart = new HeuristicLab.Clients.Hive.Views.GanttChart();
    2727      this.SuspendLayout();
    2828      //
     
    5050    #endregion
    5151
    52     private ExperimentManager.GanttChart ganttChart;
     52    private GanttChart ganttChart;
    5353
    5454  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartView.cs

    r5597 r5636  
    2020#endregion
    2121
    22 using System.Drawing;
     22using System;
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
    25 using HeuristicLab.Services.Hive.Common.DataTransfer;
    2625
    2726namespace HeuristicLab.Clients.Hive.Views {
    2827  [View("StateLogGanttChart View")]
    29   [Content(typeof(StateLogItemList), IsDefaultView = false)]
     28  [Content(typeof(StateLogList), IsDefaultView = false)]
    3029  public sealed partial class StateLogGanttChartView : ItemView {
    31     public new StateLogItemList Content {
    32       get { return (StateLogItemList)base.Content; }
     30    public new StateLogList Content {
     31      get { return (StateLogList)base.Content; }
    3332      set { base.Content = value; }
    3433    }
     
    6059        // Add code when content has been changed and is not null
    6160        ganttChart.Reset();
    62         ganttChart.AddCategory(JobState.Offline.ToString(), Color.Brown);
    63         ganttChart.AddCategory(JobState.Waiting.ToString(), Color.Yellow);
    64         ganttChart.AddCategory(JobState.Transferring.ToString(), Color.Blue);
    65         ganttChart.AddCategory(JobState.Calculating.ToString(), Color.Green);
    66         ganttChart.AddCategory(JobState.Finished.ToString(), Color.DarkGreen);
    67         ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange);
    68         ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red);
     61        StateLogGanttChartListView.SetupCategories(ganttChart);
     62        var upperLimit = DateTime.Now.AddSeconds(10);
    6963       
    7064        for (int i = 0; i < Content.Count-1; i++) {
    71           string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i].State, Content[i].DateTime, Content[i + 1].DateTime);
    72           if (!string.IsNullOrEmpty(Content[i].Exception))
    73             tooltip += "\n" + Content[i].Exception;
    74           ganttChart.AddData(0, Content[i].State.ToString(), Content[i].DateTime, Content[i + 1].DateTime, tooltip);
     65          //string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i].State, Content[i].DateTime, Content[i + 1].DateTime);
     66          //if (!string.IsNullOrEmpty(Content[i].Exception))
     67          //  tooltip += "\n" + Content[i].Exception;
     68          //ganttChart.AddData(Content[i].State.ToString(), Content[i].State.ToString(), Content[i].DateTime, Content[i + 1].DateTime, tooltip, false);
     69          StateLogGanttChartListView.AddData(ganttChart, i.ToString(), Content[i], Content[i+1], upperLimit);
    7570        }
     71        StateLogGanttChartListView.AddData(ganttChart, (Content.Count - 1).ToString(), Content[Content.Count - 1], null, upperLimit);
    7672      }
    7773    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartView.designer.cs

    r5597 r5636  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.ganttChart = new HeuristicLab.Clients.Hive.Views.ExperimentManager.GanttChart();
     26      this.ganttChart = new HeuristicLab.Clients.Hive.Views.GanttChart();
    2727      this.SuspendLayout();
    2828      //
     
    5050    #endregion
    5151
    52     private ExperimentManager.GanttChart ganttChart;
     52    private GanttChart ganttChart;
    5353
    5454  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogListView.cs

    r5597 r5636  
    2525
    2626namespace HeuristicLab.Clients.Hive.Views {
    27   [View("StateLogItem View")]
    28   [Content(typeof(IItemList<StateLogItem>), false)]
    29   public partial class StateLogListView : ItemListView<StateLogItem> {
     27  [View("StateLog View")]
     28  [Content(typeof(IItemList<StateLog>), false)]
     29  public partial class StateLogListView : ItemListView<StateLog> {
    3030
    3131    public StateLogListView() {
     
    3434    }
    3535
    36     protected override StateLogItem CreateItem() {
     36    protected override StateLog CreateItem() {
    3737      return null;
    3838    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogView.cs

    r5597 r5636  
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
     25using HeuristicLab.MainForm.WindowsForms;
    2526
    2627namespace HeuristicLab.Clients.Hive.Views {
    2728  [View("StateLog View")]
    28   [Content(typeof(StateLogItem), IsDefaultView = false)]
     29  [Content(typeof(StateLog), IsDefaultView = false)]
    2930  public sealed partial class StateLogView : ItemView {
    30     public new StateLogItem Content {
    31       get { return (StateLogItem)base.Content; }
     31    public new StateLog Content {
     32      get { return (StateLog)base.Content; }
    3233      set { base.Content = value; }
    3334    }
Note: See TracChangeset for help on using the changeset viewer.