Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6168


Ignore:
Timestamp:
05/09/11 14:12:10 (12 years ago)
Author:
cneumuel
Message:

#1233

  • removed Job-dto objects from slave core (since it stores outdated objects)
  • added command textbox to HiveJobView
  • improved the way the control buttons behave in HiveJobView
  • improved job control (pause and stop is also possible when job is not currently calculating)
  • improved gantt chart view (last state log entry is also displayed)
  • unified code for downloading jobs between experiment manager and hive engine
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
1 added
19 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConfigManager.cs

    r6110 r6168  
    113113
    114114    public int GetUsedCores() {
    115       Dictionary<Guid, Executor> engines = Core.Executors;
    116       Dictionary<Guid, Job> jobs = Core.Jobs;
    117       int usedCores = 0;
    118       lock (engines) {
    119         foreach (KeyValuePair<Guid, Job> kvp in jobs)
    120           usedCores += kvp.Value.CoresNeeded;
    121       }
    122       return usedCores;
     115      return Core.GetCoresNeeded();
    123116    }
    124117
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r6112 r6168  
    2424using System.Diagnostics;
    2525using System.IO;
     26using System.Linq;
    2627using System.ServiceModel;
    2728using System.Threading;
     
    4647    private Dictionary<Guid, Executor> executors = new Dictionary<Guid, Executor>();
    4748    private Dictionary<Guid, AppDomain> appDomains = new Dictionary<Guid, AppDomain>();
    48     private Dictionary<Guid, Job> jobs = new Dictionary<Guid, Job>();
    4949
    5050    private WcfService wcfService;
     
    5757    public Dictionary<Guid, Executor> Executors {
    5858      get { return executors; }
    59     }
    60 
    61     internal Dictionary<Guid, Job> Jobs {
    62       get { return jobs; }
    6359    }
    6460
     
    163159              Job job = wcfService.GetJob(jobId);
    164160              if (job == null) throw new JobNotFoundException(jobId);
    165               lock (executors) {
    166                 if (!jobs.ContainsKey(job.Id)) {
    167                   jobs.Add(job.Id, job);
    168                 }
    169               }
    170161              JobData jobData = wcfService.GetJobData(job.Id);
    171162              if (jobData == null) throw new JobDataNotFoundException(jobId);
     
    220211
    221212    private void DoPauseJob(Guid jobId) {
    222       if (!Jobs.ContainsKey(jobId)) {
     213      if (!executors.ContainsKey(jobId)) {
    223214        clientCom.LogMessage("DoPauseJob: Can't find job with id " + jobId);
    224215      } else {
    225         Job job = Jobs[jobId];
    226 
    227         if (job != null) {
     216        Job job = wcfService.GetJob(jobId);
     217
     218        if (job != null && executors.ContainsKey(job.Id)) {
    228219          executors[job.Id].Pause();
    229220          JobData sJob = executors[job.Id].GetPausedJob();
     
    251242
    252243    private void DoStopJob(Guid jobId) {
    253       if (!Jobs.ContainsKey(jobId)) {
     244      if (!executors.ContainsKey(jobId)) {
    254245        clientCom.LogMessage("DoStopJob: Can't find job with id " + jobId);
    255246      } else {
    256         Job job = Jobs[jobId];
     247        Job job = wcfService.GetJob(jobId);
    257248
    258249        if (job != null) {
     
    260251          JobData sJob = executors[job.Id].GetFinishedJob();
    261252          job.ExecutionTime = executors[job.Id].ExecutionTime;
    262 
    263253
    264254          try {
     
    268258            SlaveStatusInfo.JobsAborted++;
    269259
    270             clientCom.LogMessage("Sending the stoppped job with id: " + job.Id);
     260            clientCom.LogMessage("Sending the stopped job with id: " + job.Id);
    271261            wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Aborted);
    272262          }
     
    285275    /// </summary>
    286276    private void DoAbortAll() {
    287       List<Guid> guids = new List<Guid>();
    288       foreach (Guid job in Jobs.Keys) {
    289         guids.Add(job);
    290       }
    291 
    292       foreach (Guid g in guids) {
    293         KillAppDomain(g);
    294       }
    295 
     277      List<Guid> jobIds;
     278      lock (executors) {
     279        jobIds = new List<Guid>(executors.Keys);
     280      }
     281      foreach (Guid jobId in jobIds) {
     282        KillAppDomain(jobId);
     283      }
    296284      clientCom.LogMessage("Aborted all jobs!");
    297285    }
     
    304292
    305293      //copy guids because there will be removed items from 'Jobs'
    306       List<Guid> guids = new List<Guid>();
    307       foreach (Guid job in Jobs.Keys) {
    308         guids.Add(job);
    309       }
    310 
    311       foreach (Guid g in guids) {
    312         DoPauseJob(g);
     294      List<Guid> jobIds;
     295      lock (executors) {
     296        jobIds = new List<Guid>(Executors.Keys);
     297      }
     298
     299      foreach (Guid jobId in jobIds) {
     300        DoPauseJob(jobId);
    313301      }
    314302    }
     
    321309
    322310      //copy guids because there will be removed items from 'Jobs'
    323       List<Guid> guids = new List<Guid>();
    324       foreach (Guid job in Jobs.Keys) {
    325         guids.Add(job);
    326       }
    327 
    328       foreach (Guid g in guids) {
    329         DoStopJob(g);
     311      List<Guid> jobIds;
     312      lock (executors) {
     313        jobIds = new List<Guid>(executors.Keys);
     314      }
     315
     316      foreach (Guid jobId in jobIds) {
     317        DoStopJob(jobId);
    330318      }
    331319    }
     
    395383    /// </summary>
    396384    public void PauseWaitJob(JobData data) {
    397       if (!Jobs.ContainsKey(data.JobId)) {
     385      if (!Executors.ContainsKey(data.JobId)) {
    398386        clientCom.LogMessage("Can't find job with id " + data.JobId);
    399387      } else {
    400         Job job = Jobs[data.JobId];
     388        Job job = wcfService.GetJob(data.JobId);
    401389        wcfService.UpdateJobData(job, data, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused);
    402390        wcfService.UpdateJobState(job.Id, JobState.Waiting, null);
     
    416404          return;
    417405        }
    418         if (!jobs.ContainsKey(jobId)) {
     406        if (!executors.ContainsKey(jobId)) {
    419407          clientCom.LogMessage("Job doesn't exist");
    420408          return;
    421409        }
    422         Job cJob = jobs[jobId];
    423         cJob.ExecutionTime = executors[jobId].ExecutionTime;
     410        Job job = wcfService.GetJob(jobId);
     411        job.ExecutionTime = executors[jobId].ExecutionTime;
    424412
    425413        if (executors[jobId].Aborted) {
     
    436424        try {
    437425          clientCom.LogMessage("Sending the finished job with id: " + jobId);
    438           wcfService.UpdateJobData(cJob, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Finished);
     426          wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Finished);
    439427        }
    440428        catch (Exception e) {
     
    456444    /// A new Job from the wcfService has been received and will be started within a AppDomain.
    457445    /// </summary>   
    458     private void StartJobInAppDomain(Job myJob, JobData jobData) {
    459       clientCom.LogMessage("Received new job with id " + myJob.Id);
     446    private void StartJobInAppDomain(Job job, JobData jobData) {
     447      clientCom.LogMessage("Received new job with id " + job.Id);
    460448      clientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole());
    461449
    462450      lock (startInAppDomainLocker) {
    463         if (executors.ContainsKey(myJob.Id)) {
    464           clientCom.LogMessage("Job with key " + myJob.Id + " already exists. Job will be ignored.");
     451        if (executors.ContainsKey(job.Id)) {
     452          clientCom.LogMessage("Job with key " + job.Id + " already exists. Job will be ignored.");
    465453          return;
    466454        }
    467455
    468         String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, myJob.Id.ToString());
     456        String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, job.Id.ToString());
    469457        bool pluginsPrepared = false;
    470458        string configFileName = string.Empty;
    471459
    472460        try {
    473           PluginCache.Instance.PreparePlugins(myJob, out configFileName);
    474           clientCom.LogMessage("Plugins fetched for job " + myJob.Id);
     461          PluginCache.Instance.PreparePlugins(job, out configFileName);
     462          clientCom.LogMessage("Plugins fetched for job " + job.Id);
    475463          pluginsPrepared = true;
    476464        }
    477465        catch (Exception exception) {
    478           clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", myJob.Id, exception));
    479           wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString());
     466          clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", job.Id, exception));
     467          wcfService.UpdateJobState(job.Id, JobState.Failed, exception.ToString());
    480468          SlaveStatusInfo.JobsAborted++;
    481           lock (executors) {
    482             if (jobs.ContainsKey(myJob.Id)) {
    483               jobs.Remove(myJob.Id);
    484             }
    485           }
    486469        }
    487470
    488471        if (pluginsPrepared) {
    489472          try {
    490             AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(myJob.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName));
     473            AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(job.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName));
    491474            appDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException);
    492475            Executor executor;
    493             appDomains.Add(myJob.Id, appDomain);
     476            appDomains.Add(job.Id, appDomain);
    494477            clientCom.LogMessage("Creating AppDomain");
    495478            executor = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName);
    496479            clientCom.LogMessage("Created AppDomain");
    497             executor.JobId = myJob.Id;
    498480            executor.Core = this;
    499             clientCom.LogMessage("Starting Executor for job " + myJob.Id);
     481            executor.JobId = job.Id;
     482            executor.CoresNeeded = job.CoresNeeded;
     483            executor.MemoryNeeded = job.MemoryNeeded;
     484            clientCom.LogMessage("Starting Executor for job " + job.Id);
    500485            executor.Start(jobData.Data);
    501 
    502486            lock (executors) {
    503               executors.Add(myJob.Id, executor);
     487              executors.Add(job.Id, executor);
    504488            }
    505489          }
    506490          catch (Exception exception) {
    507             clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + myJob.Id);
     491            clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + job.Id);
    508492            clientCom.LogMessage("Error thrown is: " + exception.ToString());
    509493
    510             if (executors.ContainsKey(myJob.Id) && executors[myJob.Id].CurrentException != string.Empty) {
    511               wcfService.UpdateJobState(myJob.Id, JobState.Failed, executors[myJob.Id].CurrentException);
     494            if (executors.ContainsKey(job.Id) && executors[job.Id].CurrentException != string.Empty) {
     495              wcfService.UpdateJobState(job.Id, JobState.Failed, executors[job.Id].CurrentException);
    512496            } else {
    513               wcfService.UpdateJobState(myJob.Id, JobState.Failed, exception.ToString());
     497              wcfService.UpdateJobState(job.Id, JobState.Failed, exception.ToString());
    514498            }
    515499            SlaveStatusInfo.JobsAborted++;
    516500
    517             KillAppDomain(myJob.Id);
     501            KillAppDomain(job.Id);
    518502          }
    519503        }
     
    587571          }
    588572
    589           jobs.Remove(id);
    590573          PluginCache.Instance.DeletePluginsForJob(id);
    591574          GC.Collect();
     
    602585      return null; // avoid destruction of proxy object after 5 minutes
    603586    }
     587
     588    public int GetCoresNeeded() {
     589      lock (executors) {
     590        return executors.Sum(x => x.Value.CoresNeeded);
     591      }
     592    }
    604593  }
    605594}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs

    r6112 r6168  
    3434    public Guid JobId { get; set; }
    3535    public IJob Job { get; set; }
     36    public int CoresNeeded { get; set; }
     37    public int MemoryNeeded { get; set; }
    3638    private bool wasJobAborted = false;
    3739    public Core Core { get; set; }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs

    r6033 r6168  
    124124        if (Content != null && Content.Job != null) {
    125125          this.stateTextBox.Text = Content.Job.State.ToString();
     126          this.commandTextBox.Text = Content.Job.Command.ToString();
    126127          this.executionTimeTextBox.Text = Content.Job.ExecutionTime.ToString();
    127128          this.dateFinishedTextBox.Text = Content.Job.DateFinished.ToString();
     
    137138        } else {
    138139          this.stateTextBox.Text = string.Empty;
     140          this.commandTextBox.Text = string.Empty;
    139141          this.executionTimeTextBox.Text = string.Empty;
    140142          this.dateCalculatedText.Text = string.Empty;
     
    152154      this.jobIdTextBox.ReadOnly = true;
    153155      this.stateTextBox.ReadOnly = true;
     156      this.commandTextBox.ReadOnly = true;
    154157      this.executionTimeTextBox.ReadOnly = true;
    155158      this.dateCreatedTextBox.ReadOnly = true;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.designer.cs

    r6033 r6168  
    5858      this.jobIdTextBox = new System.Windows.Forms.TextBox();
    5959      this.tabControl = new System.Windows.Forms.TabControl();
     60      this.commandTextBox = new System.Windows.Forms.TextBox();
     61      this.commandLabel = new System.Windows.Forms.Label();
    6062      this.stateLogTabPage.SuspendLayout();
    6163      this.detailsTabPage.SuspendLayout();
     
    122124      //
    123125      this.splitContainer1.Panel2.Controls.Add(this.jobStatusGroupBox);
    124       this.splitContainer1.Size = new System.Drawing.Size(551, 155);
     126      this.splitContainer1.Size = new System.Drawing.Size(551, 178);
    125127      this.splitContainer1.SplitterDistance = 275;
    126128      this.splitContainer1.TabIndex = 33;
     
    139141      this.configurationGroupBox.Location = new System.Drawing.Point(0, 0);
    140142      this.configurationGroupBox.Name = "configurationGroupBox";
    141       this.configurationGroupBox.Size = new System.Drawing.Size(275, 155);
     143      this.configurationGroupBox.Size = new System.Drawing.Size(275, 178);
    142144      this.configurationGroupBox.TabIndex = 27;
    143145      this.configurationGroupBox.TabStop = false;
     
    219221      // jobStatusGroupBox
    220222      //
     223      this.jobStatusGroupBox.Controls.Add(this.commandTextBox);
     224      this.jobStatusGroupBox.Controls.Add(this.commandLabel);
    221225      this.jobStatusGroupBox.Controls.Add(this.stateTextBox);
    222226      this.jobStatusGroupBox.Controls.Add(this.dateCalculatedLabel);
     
    234238      this.jobStatusGroupBox.Location = new System.Drawing.Point(0, 0);
    235239      this.jobStatusGroupBox.Name = "jobStatusGroupBox";
    236       this.jobStatusGroupBox.Size = new System.Drawing.Size(272, 155);
     240      this.jobStatusGroupBox.Size = new System.Drawing.Size(272, 178);
    237241      this.jobStatusGroupBox.TabIndex = 24;
    238242      this.jobStatusGroupBox.TabStop = false;
     
    251255      //
    252256      this.dateCalculatedLabel.AutoSize = true;
    253       this.dateCalculatedLabel.Location = new System.Drawing.Point(7, 85);
     257      this.dateCalculatedLabel.Location = new System.Drawing.Point(7, 108);
    254258      this.dateCalculatedLabel.Name = "dateCalculatedLabel";
    255259      this.dateCalculatedLabel.Size = new System.Drawing.Size(83, 13);
     
    270274      this.dateCalculatedText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    271275                  | System.Windows.Forms.AnchorStyles.Right)));
    272       this.dateCalculatedText.Location = new System.Drawing.Point(95, 85);
     276      this.dateCalculatedText.Location = new System.Drawing.Point(95, 108);
    273277      this.dateCalculatedText.Name = "dateCalculatedText";
    274278      this.dateCalculatedText.Size = new System.Drawing.Size(171, 20);
     
    279283      this.dateFinishedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    280284                  | System.Windows.Forms.AnchorStyles.Right)));
    281       this.dateFinishedTextBox.Location = new System.Drawing.Point(95, 107);
     285      this.dateFinishedTextBox.Location = new System.Drawing.Point(95, 130);
    282286      this.dateFinishedTextBox.Name = "dateFinishedTextBox";
    283287      this.dateFinishedTextBox.Size = new System.Drawing.Size(171, 20);
     
    288292      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    289293                  | System.Windows.Forms.AnchorStyles.Right)));
    290       this.executionTimeTextBox.Location = new System.Drawing.Point(95, 41);
     294      this.executionTimeTextBox.Location = new System.Drawing.Point(95, 64);
    291295      this.executionTimeTextBox.Name = "executionTimeTextBox";
    292296      this.executionTimeTextBox.Size = new System.Drawing.Size(171, 20);
     
    297301      this.dateCreatedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    298302                  | System.Windows.Forms.AnchorStyles.Right)));
    299       this.dateCreatedTextBox.Location = new System.Drawing.Point(95, 63);
     303      this.dateCreatedTextBox.Location = new System.Drawing.Point(95, 86);
    300304      this.dateCreatedTextBox.Name = "dateCreatedTextBox";
    301305      this.dateCreatedTextBox.Size = new System.Drawing.Size(171, 20);
     
    305309      //
    306310      this.executionTimeLabel.AutoSize = true;
    307       this.executionTimeLabel.Location = new System.Drawing.Point(7, 41);
     311      this.executionTimeLabel.Location = new System.Drawing.Point(7, 64);
    308312      this.executionTimeLabel.Name = "executionTimeLabel";
    309313      this.executionTimeLabel.Size = new System.Drawing.Size(80, 13);
     
    314318      //
    315319      this.exceptionLabel.AutoSize = true;
    316       this.exceptionLabel.Location = new System.Drawing.Point(7, 129);
     320      this.exceptionLabel.Location = new System.Drawing.Point(7, 152);
    317321      this.exceptionLabel.Name = "exceptionLabel";
    318322      this.exceptionLabel.Size = new System.Drawing.Size(57, 13);
     
    323327      //
    324328      this.dateCreatedLabel.AutoSize = true;
    325       this.dateCreatedLabel.Location = new System.Drawing.Point(7, 63);
     329      this.dateCreatedLabel.Location = new System.Drawing.Point(7, 86);
    326330      this.dateCreatedLabel.Name = "dateCreatedLabel";
    327331      this.dateCreatedLabel.Size = new System.Drawing.Size(70, 13);
     
    332336      //
    333337      this.dateFinishedLabel.AutoSize = true;
    334       this.dateFinishedLabel.Location = new System.Drawing.Point(7, 107);
     338      this.dateFinishedLabel.Location = new System.Drawing.Point(7, 130);
    335339      this.dateFinishedLabel.Name = "dateFinishedLabel";
    336340      this.dateFinishedLabel.Size = new System.Drawing.Size(72, 13);
     
    342346      this.exceptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    343347                  | System.Windows.Forms.AnchorStyles.Right)));
    344       this.exceptionTextBox.Location = new System.Drawing.Point(95, 129);
     348      this.exceptionTextBox.Location = new System.Drawing.Point(95, 152);
    345349      this.exceptionTextBox.Name = "exceptionTextBox";
    346350      this.exceptionTextBox.Size = new System.Drawing.Size(171, 20);
     
    435439      this.tabControl.Size = new System.Drawing.Size(571, 401);
    436440      this.tabControl.TabIndex = 25;
     441      //
     442      // commandTextBox
     443      //
     444      this.commandTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     445                  | System.Windows.Forms.AnchorStyles.Right)));
     446      this.commandTextBox.Location = new System.Drawing.Point(95, 41);
     447      this.commandTextBox.Name = "commandTextBox";
     448      this.commandTextBox.Size = new System.Drawing.Size(171, 20);
     449      this.commandTextBox.TabIndex = 24;
     450      //
     451      // commandLabel
     452      //
     453      this.commandLabel.AutoSize = true;
     454      this.commandLabel.Location = new System.Drawing.Point(7, 41);
     455      this.commandLabel.Name = "commandLabel";
     456      this.commandLabel.Size = new System.Drawing.Size(57, 13);
     457      this.commandLabel.TabIndex = 25;
     458      this.commandLabel.Text = "Command:";
    437459      //
    438460      // HiveJobView
     
    497519    protected System.Windows.Forms.Label dateCreatedLabel;
    498520    protected System.Windows.Forms.SplitContainer splitContainer1;
     521    protected System.Windows.Forms.TextBox commandTextBox;
     522    protected System.Windows.Forms.Label commandLabel;
    499523
    500524  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/OptimizerHiveJobView.cs

    r6033 r6168  
    5454      base.SetEnabledStateOfControls();
    5555
    56       this.restartButton.Enabled = Content != null && Content.Job.State == JobState.Paused;
    57       this.pauseButton.Enabled = Content != null && Content.Job.State == JobState.Calculating;
    58       this.stopButton.Enabled = Content != null && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);
     56      this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Paused;
     57      this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating;
     58      this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);
    5959    }
    6060    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartListView.cs

    r6004 r6168  
    6464        if (Content.Count > 0) {
    6565          DateTime maxValue = Content.Max(x => x.Count > 0 ? x.Max(y => y.DateTime) : DateTime.MinValue);
    66           var upperLimit = DateTime.FromOADate(Math.Min(DateTime.Now.AddSeconds(10).ToOADate(), maxValue.AddSeconds(10).ToOADate()));
     66          DateTime upperLimit;
     67          if (Content.All(x => x.Count > 0 ? (x.Last().State == JobState.Finished || x.Last().State == JobState.Failed || x.Last().State == JobState.Aborted) : true)) {
     68            upperLimit = DateTime.FromOADate(Math.Min(DateTime.Now.AddSeconds(10).ToOADate(), maxValue.AddSeconds(10).ToOADate()));
     69          } else {
     70            upperLimit = DateTime.Now;
     71          }
    6772
    6873          for (int i = 0; i < Content.Count; i++) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartView.cs

    r5779 r6168  
    6262        StateLogGanttChartListView.SetupCategories(ganttChart);
    6363        if (Content.Count > 0) {
    64           var upperLimit = DateTime.FromOADate(Math.Min(Content.Max(x => x.DateTime).ToOADate(), DateTime.Now.AddSeconds(10).ToOADate()));
     64          DateTime upperLimit;
     65          if(Content.Last().State == JobState.Finished || Content.Last().State == JobState.Failed || Content.Last().State == JobState.Aborted) {
     66            upperLimit = DateTime.FromOADate(Math.Min(Content.Max(x => x.DateTime).ToOADate(), DateTime.Now.AddSeconds(10).ToOADate()));
     67          } else {
     68            upperLimit = DateTime.Now;
     69          }
    6570
    6671          for (int i = 0; i < Content.Count - 1; i++) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJob.cs

    r6111 r6168  
    320320
    321321    public void Pause() {
    322       ServiceLocator.Instance.CallHiveService(s => s.PauseJob(this.job.Id));
     322      if (this.Job.IsParentJob) {
     323        foreach (var child in ChildHiveJobs) {
     324          ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.job.Id));
     325        }
     326      } else {
     327        ServiceLocator.Instance.CallHiveService(s => s.PauseJob(this.job.Id));
     328      }     
    323329    }
    324330
    325331    public void Stop() {
    326       ServiceLocator.Instance.CallHiveService(s => s.StopJob(this.job.Id));
     332      if (this.Job.IsParentJob) {
     333        foreach (var child in ChildHiveJobs) {
     334          ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.job.Id));
     335        }
     336      } else {
     337        ServiceLocator.Instance.CallHiveService(s => s.StopJob(this.job.Id));
     338      }
    327339    }
    328340
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs

    r6033 r6168  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Collections.Generic;
    324using System.Linq;
    4 using System.Threading;
    5 using System.Threading.Tasks;
    625using HeuristicLab.Clients.Hive.ExperimentManager;
    726using HeuristicLab.Clients.Hive.Jobs;
     
    1130  public class HiveJobDownloader {
    1231    private IEnumerable<Guid> jobIds;
    13     private List<Task<HiveJob>> tasks;
    14     private bool abort = false;
     32    private JobDownloader<ItemJob> jobDownloader;
     33    private IDictionary<Guid, HiveJob> results;
    1534
    1635    public bool IsFinished {
    1736      get {
    18         return tasks.TrueForAll(t => t.Status == TaskStatus.RanToCompletion ||
    19                                      t.Status == TaskStatus.Faulted ||
    20                                      t.Status == TaskStatus.Canceled);
     37        //return tasks.TrueForAll(t => t.Status == TaskStatus.RanToCompletion ||
     38        //                             t.Status == TaskStatus.Faulted ||
     39        //                             t.Status == TaskStatus.Canceled);
     40        return results.Count == jobIds.Count();
    2141      }
    2242    }
     
    2444    public int FinishedCount {
    2545      get {
    26         var faulted = tasks.Where(t => t.Status == TaskStatus.Faulted);
    27         if (faulted.Count() > 0) {
    28           abort = true;
    29           throw faulted.First().Exception;
    30         }
    31         return tasks.Count(t => t.Status == TaskStatus.RanToCompletion ||
    32                                 t.Status == TaskStatus.Faulted ||
    33                                 t.Status == TaskStatus.Canceled);
     46        //var faulted = tasks.Where(t => t.Status == TaskStatus.Faulted);
     47        //if (faulted.Count() > 0) {
     48        //  abort = true;
     49        //  throw faulted.First().Exception;
     50        //}
     51        //return tasks.Count(t => t.Status == TaskStatus.RanToCompletion ||
     52        //                        t.Status == TaskStatus.Faulted ||
     53        //                        t.Status == TaskStatus.Canceled);
     54        return results.Count;
    3455      }
    3556    }
     
    3758    public IDictionary<Guid, HiveJob> Results {
    3859      get {
    39         var results = new Dictionary<Guid, HiveJob>();
    40         foreach (var t in tasks) {
    41           if (t.Status == TaskStatus.Faulted) {
    42             throw t.Exception;
    43           }
    44           if (t.Result != null)
    45             results.Add(t.Result.Job.Id, t.Result);
    46         }
     60        //var results = new Dictionary<Guid, HiveJob>();
     61        //foreach (var t in tasks) {
     62        //  if (t.Status == TaskStatus.Faulted) {
     63        //    throw t.Exception;
     64        //  }
     65        //  if (t.Result != null)
     66        //    results.Add(t.Result.Job.Id, t.Result);
     67        //}
    4768        return results;
    4869      }
     
    5172    public HiveJobDownloader(IEnumerable<Guid> jobIds) {
    5273      this.jobIds = jobIds;
     74      this.jobDownloader = new JobDownloader<ItemJob>(2, 2);
     75      this.results = new Dictionary<Guid, HiveJob>();
    5376    }
    5477
    5578    public void StartAsync() {
    56       abort = false;
    57       tasks = new List<Task<HiveJob>>();
    58       TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
    5979      foreach (Guid jobId in jobIds) {
    60         tasks.Add(Task<JobData>.Factory.StartNew(
    61           (x) => DownloadJob(x), jobId)
    62           .ContinueWith((x) => DeserializeJob(x.Result)));
     80        jobDownloader.DownloadJob(jobId,
     81          (id, itemJob, exception) => {
     82            if (exception != null) {
     83              throw new JobDownloaderException("Downloading job failed", exception);
     84            }
     85            Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(id));
     86            if (job != null && itemJob != null) {
     87              HiveJob hiveJob;
     88              if (itemJob is OptimizerJob) {
     89                hiveJob = new OptimizerHiveJob((OptimizerJob)itemJob);
     90              } else {
     91                hiveJob = new HiveJob(itemJob, true);
     92              }
     93              hiveJob.Job = job;
     94              this.results.Add(id, hiveJob);
     95            }
     96          });
    6397      }
     98
     99      //tasks = new List<Task<HiveJob>>();
     100      //TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException);
     101      //foreach (Guid jobId in jobIds) {
     102      //  tasks.Add(Task<JobData>.Factory.StartNew(
     103      //    (x) => DownloadJob(x), jobId)
     104      //    .ContinueWith((x) => DeserializeJob(x.Result)));
     105      //}
    64106    }
    65107
    66     private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
    67       e.SetObserved(); // avoid crash of process because task crashes. first exception found is handled in Results property
    68     }
     108    //private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) {
     109    //  e.SetObserved(); // avoid crash of process because task crashes. first exception found is handled in Results property
     110    //}
    69111
    70     // use semaphore to ensure only few concurrenct connections and few SerializedJob objects in memory
    71     private Semaphore downloadSemaphore = new Semaphore(2, 2);
    72     private Semaphore deserializeSemaphore = new Semaphore(2, 2);
    73     protected JobData DownloadJob(object jobId) {
    74       downloadSemaphore.WaitOne();
    75       deserializeSemaphore.WaitOne();
    76       JobData result;
    77       try {
    78         if (abort) return null;
    79         result = ServiceLocator.Instance.CallHiveService(s => s.GetJobData((Guid)jobId));
    80       }
    81       finally {
    82         downloadSemaphore.Release();
    83       }
    84       return result;
    85     }
     112    //// use semaphore to ensure only few concurrenct connections and few SerializedJob objects in memory
     113    //private Semaphore downloadSemaphore = new Semaphore(2, 2);
     114    //private Semaphore deserializeSemaphore = new Semaphore(2, 2);
     115    //protected JobData DownloadJob(object jobId) {
     116    //  downloadSemaphore.WaitOne();
     117    //  deserializeSemaphore.WaitOne();
     118    //  JobData result;
     119    //  try {
     120    //    if (abort) return null;
     121    //    result = ServiceLocator.Instance.CallHiveService(s => s.GetJobData((Guid)jobId));
     122    //  }
     123    //  finally {
     124    //    downloadSemaphore.Release();
     125    //  }
     126    //  return result;
     127    //}
    86128
    87     protected HiveJob DeserializeJob(JobData jobData) {
    88       try {
    89         Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.JobId));
    90         if (abort || job == null || jobData == null) return null;
     129    //protected HiveJob DeserializeJob(JobData jobData) {
     130    //  try {
     131    //    Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.JobId));
     132    //    if (abort || job == null || jobData == null) return null;
    91133
    92         HiveJob hiveJob;
    93         var itemJob = PersistenceUtil.Deserialize<ItemJob>(jobData.Data);
    94         if (itemJob is OptimizerJob) {
    95           hiveJob = new OptimizerHiveJob((OptimizerJob)itemJob);
    96         } else {
    97           hiveJob = new HiveJob(itemJob, true);
    98         }
    99         jobData.Data = null; // reduce memory consumption.
    100         hiveJob.Job = job;
    101         return hiveJob;
    102       }
    103       finally {
    104         deserializeSemaphore.Release();
    105       }
    106     }
     134    //    HiveJob hiveJob;
     135    //    var itemJob = PersistenceUtil.Deserialize<ItemJob>(jobData.Data);
     136    //    if (itemJob is OptimizerJob) {
     137    //      hiveJob = new OptimizerHiveJob((OptimizerJob)itemJob);
     138    //    } else {
     139    //      hiveJob = new HiveJob(itemJob, true);
     140    //    }
     141    //    jobData.Data = null; // reduce memory consumption.
     142    //    hiveJob.Job = job;
     143    //    return hiveJob;
     144    //  }
     145    //  finally {
     146    //    deserializeSemaphore.Release();
     147    //  }
     148    //}
    107149  }
    108150}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/JobDownloader.cs

    r6111 r6168  
    2020    }
    2121
    22     public void DownloadJob(Guid jobId, Action<T> onFinishedAction) {
     22    public void DownloadJob(Guid jobId, Action<Guid, T, Exception> onFinishedAction) {
    2323      Task<JobData>.Factory.StartNew((x) => DownloadJob(x), jobId)
    2424                                     .ContinueWith((x) => DeserializeJob(x.Result))
    25                                      .ContinueWith((x) => OnJobFinished(x.Result, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously);
     25                                     .ContinueWith((x) => OnJobFinished(jobId, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously);
    2626    }
    2727
    28     private T OnJobFinished(T job, Action<T> onFinishedAction) {
    29       onFinishedAction(job);
    30       return job;
     28    private void OnJobFinished(Guid jobId, Task<T> task, Action<Guid, T, Exception> onFinishedAction) {
     29      onFinishedAction(jobId, task.Result, task.Exception);
    3130    }
    3231
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs

    r6110 r6168  
    3535    private JobResultPoller jobResultPoller;
    3636    private JobDownloader<ItemJob> jobDownloader = new JobDownloader<ItemJob>(2, 2);
     37    private static object locker = new object();
    3738
    3839    [Storable]
     
    6667      get { return refreshAutomatically; }
    6768      set {
    68         if (refreshAutomatically != value) {
    69           refreshAutomatically = value;
    70           OnRefreshAutomaticallyChanged();
    71         }
    72         if (RefreshAutomatically && hiveExperiment.HiveJobs != null && hiveExperiment.HiveJobs.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) {
    73           StartResultPolling();
    74         } else {
    75           StopResultPolling();
     69        lock (locker) {
     70          if (refreshAutomatically != value) {
     71            refreshAutomatically = value;
     72            OnRefreshAutomaticallyChanged();
     73          }
     74          if (RefreshAutomatically) {
     75            if (hiveExperiment.HiveJobs != null && hiveExperiment.HiveJobs.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) {
     76              StartResultPolling();
     77            }
     78          } else {
     79            StopResultPolling();
     80          }
    7681        }
    7782      }
     
    156161          // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated
    157162          if (lastJobDataUpdate != DateTime.MinValue && lastJobDataUpdate < hj.Job.LastJobDataUpdate) {
    158             jobDownloader.DownloadJob(hj.Job.Id, (itemJob) => {
     163            jobDownloader.DownloadJob(hj.Job.Id, (id, itemJob, exception) => {
     164              if (exception != null) {
     165                throw new JobDownloaderException("Downloading job failed.", exception);
     166              }
     167
    159168              if (itemJob == null) {
    160169                // something bad happened to this job. bad job, BAAAD job!
     
    218227      hiveExperiment.ExecutionTime = TimeSpan.FromMilliseconds(hiveExperiment.GetAllHiveJobs().Sum(x => x.Job.ExecutionTime.HasValue ? x.Job.ExecutionTime.Value.TotalMilliseconds : 0));
    219228    }
    220 
    221     public void OnLoaded() {
    222       this.UpdateTotalExecutionTime();
    223 
    224       if (hiveExperiment.ExecutionState != ExecutionState.Stopped) {
    225         this.RefreshAutomatically = true;
    226       }
    227     }
    228229    #endregion
    229230
     
    235236      hiveExperiment.ModifiedChanged += new EventHandler(hiveExperiment_ModifiedChanged);
    236237      hiveExperiment.IsProgressingChanged += new EventHandler(hiveExperiment_IsProgressingChanged);
     238      hiveExperiment.Loaded += new EventHandler(hiveExperiment_Loaded);
    237239    }
    238240
     
    244246      hiveExperiment.ModifiedChanged -= new EventHandler(hiveExperiment_ModifiedChanged);
    245247      hiveExperiment.IsProgressingChanged -= new EventHandler(hiveExperiment_IsProgressingChanged);
     248      hiveExperiment.Loaded -= new EventHandler(hiveExperiment_Loaded);
     249    }
     250
     251    private void hiveExperiment_Loaded(object sender, EventArgs e) {
     252      this.UpdateTotalExecutionTime();
     253
     254      if (hiveExperiment.ExecutionState != ExecutionState.Stopped) {
     255        this.RefreshAutomatically = true;
     256      }
    246257    }
    247258
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj

    r6111 r6168  
    123123    <Compile Include="ExperimentManager\ExperimentManagerClient.cs" />
    124124    <Compile Include="ExperimentManager\HiveJobDownloader.cs" />
     125    <Compile Include="ExperimentManager\JobDownloaderException.cs" />
    125126    <Compile Include="ExperimentManager\TreeView\IItemTree.cs" />
    126127    <Compile Include="ExperimentManager\TreeView\IItemTreeAction.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperiment.cs

    r6033 r6168  
    119119    #region Events
    120120    public event EventHandler ExecutionTimeChanged;
    121     private void OnExecutionTimeChanged() {
    122       EventHandler handler = ExecutionTimeChanged;
     121    protected virtual void OnExecutionTimeChanged() {
     122      var handler = ExecutionTimeChanged;
    123123      if (handler != null) handler(this, EventArgs.Empty);
    124124    }
    125125
    126126    public event EventHandler ExecutionStateChanged;
    127     private void OnExecutionStateChanged() {
    128       EventHandler handler = ExecutionStateChanged;
     127    protected virtual void OnExecutionStateChanged() {
     128      var handler = ExecutionStateChanged;
    129129      if (handler != null) handler(this, EventArgs.Empty);
    130130    }
     
    132132    public event EventHandler HiveJobsChanged;
    133133    protected virtual void OnHiveJobsChanged() {
    134       EventHandler handler = HiveJobsChanged;
     134      var handler = HiveJobsChanged;
    135135      if (handler != null) handler(this, EventArgs.Empty);
    136136    }
    137137
    138138    public event EventHandler IsProgressingChanged;
    139     private void OnIsProgressingChanged() {
    140       EventHandler handler = IsProgressingChanged;
     139    protected virtual void OnIsProgressingChanged() {
     140      var handler = IsProgressingChanged;
     141      if (handler != null) handler(this, EventArgs.Empty);
     142    }
     143
     144    public event EventHandler Loaded;
     145    public virtual void OnLoaded() {
     146      var handler = Loaded;
    141147      if (handler != null) handler(this, EventArgs.Empty);
    142148    }
     
    175181      return Name;
    176182    }
    177 
    178     public virtual void OnLoaded() { }
    179183  }
    180184}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/app_ascheibe.config

    r6167 r6168  
    11<?xml version="1.0"?>
    22<configuration>
    3     <system.serviceModel>
    4         <bindings>
    5           <wsHttpBinding>
    6             <binding name="wsHttpBinding_Hive" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    7               <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="2147483647"/>
    8               <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
    9               <security mode="Message">
    10                 <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
    11                 <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/>
    12               </security>
    13             </binding>
    14           </wsHttpBinding>
    15             </bindings>
    16       <client>
     3  <system.serviceModel>
     4    <bindings>
     5      <wsHttpBinding>
     6        <binding name="wsHttpBinding_IHiveService"
     7                 closeTimeout="00:01:00"
     8                 openTimeout="00:01:00"
     9                 receiveTimeout="00:20:00"
     10                 sendTimeout="00:20:00"
     11                 bypassProxyOnLocal="false"
     12                 transactionFlow="false"
     13                 hostNameComparisonMode="StrongWildcard"
     14                 maxBufferPoolSize="2147483647"
     15                 maxReceivedMessageSize="2147483647"
     16                 messageEncoding="Text"
     17                 textEncoding="utf-8"
     18                 useDefaultWebProxy="true"
     19                 allowCookies="false">
     20
     21          <readerQuotas maxDepth="2147483647"
     22                        maxStringContentLength="2147483647"
     23                        maxArrayLength="2147483647"
     24                        maxBytesPerRead="2147483647"
     25                        maxNameTableCharCount="2147483647"/>
     26          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     27          <security mode="Message">
     28            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
     29            <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/>
     30          </security>
     31        </binding>
     32      </wsHttpBinding>
     33    </bindings>
     34    <client>
    1735      <endpoint address="http://localhost/HiveService.svc"
    1836            binding="wsHttpBinding"
    19             bindingConfiguration="wsHttpBinding_Hive"
     37            bindingConfiguration="wsHttpBinding_IHiveService"
    2038            contract="HeuristicLab.Clients.Hive.IHiveService"
    2139            name="wsHttpBinding_IHiveService">
     
    2543
    2644      </endpoint>
    27       </client>
    28     </system.serviceModel>
    29 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
     45    </client>
     46  </system.serviceModel>
     47  <startup>
     48    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
     49  </startup>
     50</configuration>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/app_f005pc.config

    r6167 r6168  
    11<?xml version="1.0"?>
    22<configuration>
    3     <system.serviceModel>
    4         <bindings>
    5             <wsHttpBinding>
    6                 <binding name="wsHttpBinding_Hive" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    7                   <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
    8                   <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
    9                   <security mode="Message">
    10                     <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
    11                     <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/>
    12                   </security>
    13                 </binding>
    14               </wsHttpBinding>
    15             </bindings>
    16         <client>
    17             <endpoint address="http://localhost/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
    18               <identity>
    19                 <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>
    20               </identity>
    21             </endpoint>
    22         </client>
    23     </system.serviceModel>
    24 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
     3  <system.serviceModel>
     4    <bindings>
     5      <wsHttpBinding>
     6        <binding name="wsHttpBinding_IHiveService"
     7                 closeTimeout="00:01:00"
     8                 openTimeout="00:01:00"
     9                 receiveTimeout="00:20:00"
     10                 sendTimeout="00:20:00"
     11                 bypassProxyOnLocal="false"
     12                 transactionFlow="false"
     13                 hostNameComparisonMode="StrongWildcard"
     14                 maxBufferPoolSize="2147483647"
     15                 maxReceivedMessageSize="2147483647"
     16                 messageEncoding="Text"
     17                 textEncoding="utf-8"
     18                 useDefaultWebProxy="true"
     19                 allowCookies="false">
     20
     21          <readerQuotas maxDepth="2147483647"
     22                        maxStringContentLength="2147483647"
     23                        maxArrayLength="2147483647"
     24                        maxBytesPerRead="2147483647"
     25                        maxNameTableCharCount="2147483647"/>
     26          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     27          <security mode="Message">
     28            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
     29            <message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default"/>
     30          </security>
     31        </binding>
     32      </wsHttpBinding>
     33    </bindings>
     34    <client>
     35      <endpoint address="http://localhost/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
     36        <identity>
     37          <certificate encodedValue="AwAAAAEAAAAUAAAAfEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>
     38        </identity>
     39      </endpoint>
     40    </client>
     41  </system.serviceModel>
     42  <startup>
     43    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
     44  </startup>
     45</configuration>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/app_services.config

    r6167 r6168  
    44    <bindings>
    55      <wsHttpBinding>
    6         <binding name="wsHttpBinding_Hive"
     6        <binding name="wsHttpBinding_IHiveService"
    77                 closeTimeout="00:01:00"
    88                 openTimeout="00:01:00"
     
    3333    </bindings>
    3434    <client>
    35       <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
     35      <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">
    3636        <identity>
    3737          <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgNVHQEETjBMgBCjbgdYd4j5JgUuJ1Wo/GxroSYwJDEiMCAGA1UEAxMZc2VydmljZXMuaGV1cmlzdGljbGFiLmNvbYIQCJLHkNhBIYFO9tKiQOtYKjANBgkqhkiG9w0BAQQFAAOBgQAb/2xk2uQad68shSPl/uixWgvFI8WkxOTBopOLaLtDxwCeZ3mWVHdV9VnixHtThubnEBXAhYOCQSIXWtQuXFWO+gH3YyjTRJY5kTmXyuvBRTn3/so5SrQ7Rdlm9hf6E5YVX3tCjAy7ybUyaDUkQfmH5vmvgvpMzRfsJ1qhnUpJiQ=="/>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config

    r6167 r6168  
    3030    <bindings>
    3131      <wsHttpBinding>
    32         <binding name="WSHttpBinding_IHiveService" receiveTimeout="00:20:00"
    33           sendTimeout="00:20:00" maxBufferPoolSize="104857600" maxReceivedMessageSize="104857600">
    34           <readerQuotas maxStringContentLength="104857600" maxArrayLength="104857600" />
     32
     33        <binding name="WSHttpBinding_IHiveService"
     34                 receiveTimeout="00:10:00"
     35                 sendTimeout="00:10:00"
     36                 maxBufferPoolSize="2147483647"
     37                 maxReceivedMessageSize="2147483647">
     38          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
    3539          <security mode="Message">
    3640            <transport clientCredentialType="Certificate"/>
     
    5559          <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false" messageAuthenticationAuditLevel="SuccessOrFailure" />
    5660          <serviceThrottling maxConcurrentCalls="100" />
     61          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
    5762        </behavior>
    5863      </serviceBehaviors>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r6110 r6168  
    171171    public void StopJob(Guid jobId) {
    172172      trans.UseTransaction(() => {
    173         //dao.UpdateJobState(jobId, JobState.Aborted, null, auth.UserId, string.Empty);
    174173        var job = dao.GetJob(jobId);
    175         job.Command = Command.Stop;
    176         dao.UpdateJob(job);
     174        if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
     175          job.Command = Command.Stop;
     176          dao.UpdateJob(job);
     177        } else {
     178          if (job.State != JobState.Aborted && job.State != JobState.Finished && job.State != JobState.Failed) {
     179            job = UpdateJobState(jobId, JobState.Aborted, null, null, string.Empty);
     180          }
     181        }
    177182      });
    178183    }
     
    183188    public void PauseJob(Guid jobId) {
    184189      trans.UseTransaction(() => {
    185         //dao.UpdateJobState(jobId, JobState.Paused, null, auth.UserId, string.Empty);
    186190        var job = dao.GetJob(jobId);
    187         job.Command = Command.Pause;
    188         dao.UpdateJob(job);
     191        if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
     192          job.Command = Command.Pause;
     193          dao.UpdateJob(job);
     194        } else {
     195          job = UpdateJobState(jobId, JobState.Paused, null, null, string.Empty);
     196        }
    189197      });
    190198    }
Note: See TracChangeset for help on using the changeset viewer.