Ejemplo n.º 1
0
        public void OnStatusChanged(StatusCommons status)
        {
            var handler = SlaveStatusChanged;

            if (handler != null)
            {
                handler(this, new EventArgs <StatusCommons>(status));
            }

            OnSlaveDisplayStateChanged(status);

            int diff = status.JobsFetched - lastJobsFetched;

            lastJobsFetched = status.JobsFetched;
            if (diff > 0)
            {
                if (diff == 1)
                {
                    OnUserVisibleMessageFired("HeuristicLab Hive received 1 new task!");
                }
                else
                {
                    OnUserVisibleMessageFired(string.Format("HeuristicLab Hive received {0} new jobs!", diff));
                }
            }
        }
Ejemplo n.º 2
0
        public void OnStatusChanged(StatusCommons status)
        {
            string msg = string.Format("{0}: {1}", DateTime.Now.ToString("HH:mm:ss"), status);

            Console.WriteLine(msg);
            debugOutput.WriteLine(msg);
        }
Ejemplo n.º 3
0
        public void OnSlaveDisplayStateChanged(StatusCommons status)
        {
            SlaveDisplayStat stat;

            if (status.Jobs.Count > 0)
            {
                stat = SlaveDisplayStat.Busy;
            }
            else
            {
                stat = SlaveDisplayStat.Idle;
            }
            if (status.Asleep)
            {
                stat = SlaveDisplayStat.Asleep;
            }
            if (status.Status == NetworkEnum.WcfConnState.Disconnected || status.Status == NetworkEnum.WcfConnState.Failed)
            {
                stat = SlaveDisplayStat.Offline;
            }

            var handler = SlaveDisplayStateChanged;

            if (handler != null)
            {
                handler(this, new EventArgs <SlaveDisplayStat>(stat));
            }
        }
Ejemplo n.º 4
0
        private void RenderJobChart(StatusCommons status)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <StatusCommons>(RenderJobChart), status);
            }
            else
            {
                taskChart.Series[0].Points.Clear();
                taskChart.Series[1].Points.Clear();
                taskChart.Series[2].Points.Clear();
                taskChart.Series[3].Points.Clear();
                taskChart.Series[4].Points.Clear();


                DataPoint pJobs        = new DataPoint(1, status.Jobs.Count);
                DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted);
                DataPoint pJobsDone    = new DataPoint(3, status.JobsFinished);
                DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched);
                DataPoint pJobsFailed  = new DataPoint(5, status.JobsFailed);

                pJobs.LegendText               = "Current tasks: " + status.Jobs.Count;
                pJobs.Color                    = System.Drawing.Color.Yellow;
                pJobs.ToolTip                  = pJobs.LegendText;
                taskChart.Series[0].Color      = System.Drawing.Color.Yellow;
                taskChart.Series[0].LegendText = pJobs.LegendText;
                taskChart.Series[0].Points.Add(pJobs);

                pJobsAborted.LegendText        = "Aborted tasks: " + status.JobsAborted;
                pJobsAborted.Color             = System.Drawing.Color.Orange;
                pJobsAborted.ToolTip           = pJobsAborted.LegendText;
                taskChart.Series[1].Color      = System.Drawing.Color.Orange;
                taskChart.Series[1].LegendText = pJobsAborted.LegendText;
                taskChart.Series[1].Points.Add(pJobsAborted);

                pJobsDone.LegendText           = "Finished tasks: " + status.JobsFinished;
                pJobsDone.Color                = System.Drawing.Color.Green;
                pJobsDone.ToolTip              = pJobsDone.LegendText;
                taskChart.Series[2].Color      = System.Drawing.Color.Green;
                taskChart.Series[2].LegendText = pJobsDone.LegendText;
                taskChart.Series[2].Points.Add(pJobsDone);

                pJobsFetched.LegendText        = "Fetched tasks: " + status.JobsFetched;
                pJobsFetched.ToolTip           = pJobsFetched.LegendText;
                pJobsFetched.Color             = System.Drawing.Color.Blue;
                taskChart.Series[3].Color      = System.Drawing.Color.Blue;
                taskChart.Series[3].LegendText = pJobsFetched.LegendText;
                taskChart.Series[3].Points.Add(pJobsFetched);

                pJobsFailed.LegendText         = "Failed tasks: " + status.JobsFailed;
                pJobsFailed.ToolTip            = pJobsFailed.LegendText;
                pJobsFailed.Color              = System.Drawing.Color.Red;
                taskChart.Series[4].Color      = System.Drawing.Color.Red;
                taskChart.Series[4].LegendText = pJobsFailed.LegendText;
                taskChart.Series[4].Points.Add(pJobsFailed);
            }
        }
Ejemplo n.º 5
0
 public bool ReconnectToSlaveCore()
 {
     try {
         DeregisterEvents();
         pipeProxy = pipeFactory.CreateChannel();
         StatusCommons st = pipeProxy.Subscribe();
         if (st != null)
         {
             RegisterEvents();
             OnStatusChanged(st);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception) {
         OnMessageLogged("Couldn't connect to Slave core. Is it possible that the core isn't running?");
         return(false);
     }
 }
Ejemplo n.º 6
0
        private void RenderCoreChart(StatusCommons statusCommons)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <StatusCommons>(RenderCoreChart), statusCommons);
            }
            else
            {
                int       usedCores  = statusCommons.TotalCores - statusCommons.FreeCores;
                DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores);
                DataPoint pUsedCores = new DataPoint(usedCores, usedCores);

                coresChart.Series[0].Points.Clear();

                pFreeCores.LegendText = "Free: " + statusCommons.FreeCores;
                pFreeCores.Color      = System.Drawing.Color.Green;
                pUsedCores.LegendText = "Used: " + usedCores;
                pUsedCores.Color      = System.Drawing.Color.Red;

                coresChart.Series[0].Points.Add(pFreeCores);
                coresChart.Series[0].Points.Add(pUsedCores);
            }
        }
Ejemplo n.º 7
0
 public void OnStatusChanged(StatusCommons status) {
   string msg = string.Format("{0}: {1}", DateTime.Now.ToString("HH:mm:ss"), status);
   Console.WriteLine(msg);
   debugOutput.WriteLine(msg);
 }
Ejemplo n.º 8
0
    public void OnStatusChanged(StatusCommons status) {
      var handler = SlaveStatusChanged;
      if (handler != null) handler(this, new EventArgs<StatusCommons>(status));

      OnSlaveDisplayStateChanged(status);

      int diff = status.JobsFetched - lastJobsFetched;
      lastJobsFetched = status.JobsFetched;
      if (diff > 0) {
        if (diff == 1) {
          OnUserVisibleMessageFired("HeuristicLab Hive received 1 new task!");
        } else {
          OnUserVisibleMessageFired(string.Format("HeuristicLab Hive received {0} new jobs!", diff));
        }
      }
    }
Ejemplo n.º 9
0
    public void OnSlaveDisplayStateChanged(StatusCommons status) {
      SlaveDisplayStat stat;

      if (status.Jobs.Count > 0) {
        stat = SlaveDisplayStat.Busy;
      } else {
        stat = SlaveDisplayStat.Idle;
      }
      if (status.Asleep) {
        stat = SlaveDisplayStat.Asleep;
      }
      if (status.Status == NetworkEnum.WcfConnState.Disconnected || status.Status == NetworkEnum.WcfConnState.Failed) {
        stat = SlaveDisplayStat.Offline;
      }

      var handler = SlaveDisplayStateChanged;
      if (handler != null) handler(this, new EventArgs<SlaveDisplayStat>(stat));
    }
Ejemplo n.º 10
0
    private void RenderJobChart(StatusCommons status) {
      if (InvokeRequired) {
        Invoke(new Action<StatusCommons>(RenderJobChart), status);
      } else {
        taskChart.Series[0].Points.Clear();
        taskChart.Series[1].Points.Clear();
        taskChart.Series[2].Points.Clear();
        taskChart.Series[3].Points.Clear();
        taskChart.Series[4].Points.Clear();


        DataPoint pJobs = new DataPoint(1, status.Jobs.Count);
        DataPoint pJobsAborted = new DataPoint(2, status.JobsAborted);
        DataPoint pJobsDone = new DataPoint(3, status.JobsFinished);
        DataPoint pJobsFetched = new DataPoint(4, status.JobsFetched);
        DataPoint pJobsFailed = new DataPoint(5, status.JobsFailed);

        pJobs.LegendText = "Current tasks: " + status.Jobs.Count;
        pJobs.Color = System.Drawing.Color.Yellow;
        pJobs.ToolTip = pJobs.LegendText;
        taskChart.Series[0].Color = System.Drawing.Color.Yellow;
        taskChart.Series[0].LegendText = pJobs.LegendText;
        taskChart.Series[0].Points.Add(pJobs);

        pJobsAborted.LegendText = "Aborted tasks: " + status.JobsAborted;
        pJobsAborted.Color = System.Drawing.Color.Orange;
        pJobsAborted.ToolTip = pJobsAborted.LegendText;
        taskChart.Series[1].Color = System.Drawing.Color.Orange;
        taskChart.Series[1].LegendText = pJobsAborted.LegendText;
        taskChart.Series[1].Points.Add(pJobsAborted);

        pJobsDone.LegendText = "Finished tasks: " + status.JobsFinished;
        pJobsDone.Color = System.Drawing.Color.Green;
        pJobsDone.ToolTip = pJobsDone.LegendText;
        taskChart.Series[2].Color = System.Drawing.Color.Green;
        taskChart.Series[2].LegendText = pJobsDone.LegendText;
        taskChart.Series[2].Points.Add(pJobsDone);

        pJobsFetched.LegendText = "Fetched tasks: " + status.JobsFetched;
        pJobsFetched.ToolTip = pJobsFetched.LegendText;
        pJobsFetched.Color = System.Drawing.Color.Blue;
        taskChart.Series[3].Color = System.Drawing.Color.Blue;
        taskChart.Series[3].LegendText = pJobsFetched.LegendText;
        taskChart.Series[3].Points.Add(pJobsFetched);

        pJobsFailed.LegendText = "Failed tasks: " + status.JobsFailed;
        pJobsFailed.ToolTip = pJobsFailed.LegendText;
        pJobsFailed.Color = System.Drawing.Color.Red;
        taskChart.Series[4].Color = System.Drawing.Color.Red;
        taskChart.Series[4].LegendText = pJobsFailed.LegendText;
        taskChart.Series[4].Points.Add(pJobsFailed);
      }
    }
Ejemplo n.º 11
0
    private void RenderCoreChart(StatusCommons statusCommons) {
      if (InvokeRequired) {
        Invoke(new Action<StatusCommons>(RenderCoreChart), statusCommons);
      } else {
        int usedCores = statusCommons.TotalCores - statusCommons.FreeCores;
        DataPoint pFreeCores = new DataPoint(statusCommons.FreeCores, statusCommons.FreeCores);
        DataPoint pUsedCores = new DataPoint(usedCores, usedCores);

        coresChart.Series[0].Points.Clear();

        pFreeCores.LegendText = "Free: " + statusCommons.FreeCores;
        pFreeCores.Color = System.Drawing.Color.Green;
        pUsedCores.LegendText = "Used: " + usedCores;
        pUsedCores.Color = System.Drawing.Color.Red;

        coresChart.Series[0].Points.Add(pFreeCores);
        coresChart.Series[0].Points.Add(pUsedCores);
      }
    }