Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/01/10 13:58:24 (14 years ago)
Author:
kgrading
Message:

Removed References to HiveLogging and updated the default logging mechanism (#991)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs

    r3220 r3578  
    242242        CloneList(jobsOld, out jobsOldHelp);
    243243
    244         GetDelta(jobsOld.List, jobsOldHelp);
     244        if(jobsOld != null && jobsOld.List != null && jobsOldHelp != null)
     245          GetDelta(jobsOld.List, jobsOldHelp);
    245246
    246247      }
     
    419420      lvJobDetails.Items.Clear();
    420421
    421       lvSnapshots.Enabled = true;
    422 
    423       if (currentJob.State == State.offline) {
     422      ResponseObject<JobDto> response = ServiceLocator.GetJobManager().GetJobByIdWithDetails(currentJob.Id);
     423
     424      if(response.Success == false || response.Obj == null)
     425        return;
     426
     427      JobDto job = response.Obj;
     428
     429      //lvSnapshots.Enabled = true;
     430
     431      if (job.State == State.offline) {
    424432        pbJobControl.Image = ilLargeImgJob.Images[2];
    425       } else if (currentJob.State == State.calculating) {
     433      } else if (job.State == State.calculating) {
    426434        pbJobControl.Image = ilLargeImgJob.Images[1];
    427       } else if (currentJob.State == State.finished) {
     435      } else if (job.State == State.finished) {
    428436        pbJobControl.Image = ilLargeImgJob.Images[0];
    429437      }
    430438
    431       lblJobName.Text = currentJob.Id.ToString();
    432       if (currentJob.Percentage != null) {
     439      lblJobName.Text = job.Id.ToString();
     440      if (job.Percentage != null) {
    433441        progressJob.Value = (int) (currentJob.Percentage*100);
    434442        lblProgress.Text = (int) (currentJob.Percentage*100) + "% calculated";
     
    437445      ListViewItem lvi = new ListViewItem();
    438446      lvi.Text = "User:";
    439       lvi.SubItems.Add(currentJob.UserId.ToString());
     447      lvi.SubItems.Add(job.UserId.ToString());
    440448      lvJobDetails.Items.Add(lvi);
    441449
     
    443451      lvi = new ListViewItem();
    444452      lvi.Text = "created at:";
    445       lvi.SubItems.Add(currentJob.DateCreated.ToString());
     453      lvi.SubItems.Add(job.DateCreated.ToString());
    446454      lvJobDetails.Items.Add(lvi);
    447455
    448       if (currentJob.ParentJob != null) {
     456      if (job.ParentJob != null) {
    449457        lvi = null;
    450458        lvi = new ListViewItem();
    451459        lvi.Text = "Parent job:";
    452         lvi.SubItems.Add(currentJob.ParentJob.ToString());
     460        lvi.SubItems.Add(job.ParentJob.ToString());
    453461        lvJobDetails.Items.Add(lvi);
    454462      }
     
    457465      lvi = new ListViewItem();
    458466      lvi.Text = "Priority:";
    459       lvi.SubItems.Add(currentJob.Priority.ToString());
     467      lvi.SubItems.Add(job.Priority.ToString());
    460468      lvJobDetails.Items.Add(lvi);
    461469
    462       if (currentJob.Project != null) {
     470      if (job.Project != null) {
    463471        lvi = null;
    464472        lvi = new ListViewItem();
    465473        lvi.Text = "Project:";
    466         lvi.SubItems.Add(currentJob.Project.Name.ToString());
     474        lvi.SubItems.Add(job.Project.Name.ToString());
    467475        lvJobDetails.Items.Add(lvi);
    468476      }
    469477
    470       if (currentJob.Client != null) {
     478      if (job.Client != null) {
    471479        lvi = null;
    472480        lvi = new ListViewItem();
    473481        lvi.Text = "Calculation begin:";
    474         lvi.SubItems.Add(currentJob.DateCalculated.ToString());
     482        lvi.SubItems.Add(job.DateCalculated.ToString());
    475483        lvJobDetails.Items.Add(lvi);
    476484
     
    479487        lvi = new ListViewItem();
    480488        lvi.Text = "Client calculated:";
    481         lvi.SubItems.Add(currentJob.Client.Name.ToString());
     489        lvi.SubItems.Add(job.Client.Name.ToString());
    482490        lvJobDetails.Items.Add(lvi);
    483491
    484         if (currentJob.State == State.finished) {
    485           IJobManager jobManager =
    486             ServiceLocator.GetJobManager();
    487           ResponseObject<JobResult> jobRes = null;
    488           //Todo: jobManager.GetLastJobResultOf(currentJob.Id);
    489 
    490           if (jobRes != null && jobRes.Obj != null) {
    491             lvi = null;
     492        if (job.State == State.finished) {
     493          lvi = null;
    492494            lvi = new ListViewItem();
    493495            lvi.Text = "Calculation ended:";
    494             lvi.SubItems.Add(jobRes.Obj.DateFinished.ToString());
     496            lvi.SubItems.Add(job.DateFinished.ToString());
    495497            lvJobDetails.Items.Add(lvi);
    496498          }
    497499        }
    498       }
    499       if (currentJob.State != State.offline) {
    500         lvSnapshots.Items.Clear();
    501         GetSnapshotList();
    502       } else {
    503         lvSnapshots.Visible = false;
    504       }
    505     }
     500      }
    506501
    507502    /// <summary>
     
    776771    private void CloneList(ResponseList<JobDto> oldList, out IDictionary<int, JobDto> newList) {
    777772      newList = new Dictionary<int, JobDto>();
    778       for (int i = 0; i < oldList.List.Count; i++) {
    779         newList.Add(i, oldList.List[i]);
     773      if (oldList != null && oldList.List != null) {
     774        for (int i = 0; i < oldList.List.Count; i++) {
     775          newList.Add(i, oldList.List[i]);
     776        }
    780777      }
    781778    }
    782779
    783780    private bool IsEqual(ClientDto ci1, ClientDto ci2) {
     781      if (ci1 == null && ci2 == null) {
     782        return true;
     783      }
    784784      if (ci2 == null) {
    785785        return false;
     
    849849    }
    850850
    851     private void GetSnapshotList() {
    852 
    853       lvSnapshots.Items.Clear();
    854       IJobManager jobManager = ServiceLocator.GetJobManager();
    855 
    856       ResponseList<JobResult> jobRes = jobManager.GetAllJobResults(currentJob.Id);
    857 
    858       if (jobRes != null && jobRes.List != null) {
    859         foreach (JobResult jobresult in jobRes.List) {
    860           ListViewItem curSnapshot = new ListViewItem(jobresult.ClientId.ToString());
    861           double percentage = jobresult.Percentage * 100;
    862           curSnapshot.SubItems.Add(percentage.ToString() + " %");
    863           curSnapshot.SubItems.Add(jobresult.Timestamp.ToString());
    864           lvSnapshots.Items.Add(curSnapshot);
    865         }
    866       }
    867 
    868       if ((jobRes.List == null) || (jobRes.List.Count == 0)) {
    869         lvSnapshots.Visible = false;
    870       } else {
    871         lvSnapshots.Visible = true;
    872       }
    873 
    874     }
    875 
    876851    #endregion
    877852
Note: See TracChangeset for help on using the changeset viewer.