Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/11 14:47:56 (14 years ago)
Author:
cneumuel
Message:

#1233

  • added StateLog to log state transitions of hive jobs
  • added permissions to hive experiments (in data access layer, no UI for that yet)
  • extended unit tests
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs

    r5458 r5511  
    2929  public class HiveExperiment : NamedHiveItem {
    3030    [DataMember]
    31     public Guid UserId { get; set; }
     31    public Guid OwnerUserId { get; set; }
    3232    [DataMember]
    3333    public Guid RootJobId { get; set; }
     
    3636    [DataMember]
    3737    public string ResourceNames { get; set; }
     38    [DataMember]
     39    public DateTime? LastAccessed { get; set; }
    3840
    3941    public HiveExperiment() { }
    4042    protected HiveExperiment(HiveExperiment original, Cloner cloner) : base(original, cloner) {
    4143      this.RootJobId = original.RootJobId;
    42       this.UserId = original.UserId;
     44      this.OwnerUserId = original.OwnerUserId;
    4345      this.DateCreated = original.DateCreated;
    4446      this.ResourceNames = original.ResourceNames;
     47      this.LastAccessed = original.LastAccessed;
    4548    }
    4649    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Job.cs

    r5405 r5511  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Linq;
    2524using System.Runtime.Serialization;
    2625using HeuristicLab.Common;
     
    3029  [Serializable]
    3130  public class Job : LightweightJob {
    32     [DataMember]
    33     public Guid UserId { get; set; }
    3431    [DataMember]
    3532    public int Priority { get; set; }
     
    4239    [DataMember]
    4340    public DateTime? LastHeartbeat { get; set; }
    44 
     41   
    4542    public Job() {
    4643      this.PluginsNeededIds = new List<Guid>();
    4744    }
    4845    protected Job(Job original, Cloner cloner) : base(original, cloner) {
    49       this.UserId = original.UserId;
    5046      this.Priority = original.Priority;
    5147      this.CoresNeeded = original.CoresNeeded;
     
    5955
    6056    public override string ToString() {
    61       return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", JobState, SlaveId, DateCreated, DateCalculated, CoresNeeded, MemoryNeeded);
     57      return string.Format("State: {0}, SlaveId: {1}, DateCreated: {2}, DateCalculated: {3}, CoresNeeded: {4}, MemoryNeeded: {5}", State, CurrentStateLog.SlaveId, DateCreated, CoresNeeded, MemoryNeeded);
    6258    }
    6359
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs

    r4649 r5511  
    3333    Waiting,
    3434
    35         /// <summary>
     35    /// <summary>
     36    /// The job is set to Finished when all child jobs are Finished.
     37    /// </summary>
     38    FinishOnChildJobsFinished,
     39
     40    /// <summary>
    3641    /// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished.
    3742    /// </summary>
    38     WaitingForChildJobs,
     43    ResumeOnChildJobsFinished,
     44
     45    /// <summary>
     46    /// Job is beeing transferred
     47    /// </summary>
     48    Transferring,
    3949
    4050    /// <summary>
     
    7282    public static bool IsWaiting(this JobState jobState) {
    7383      return jobState == JobState.Waiting ||
    74         jobState == JobState.WaitingForChildJobs;
     84        jobState == JobState.FinishOnChildJobsFinished;
    7585    }
    7686
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/LightweightJob.cs

    r5106 r5511  
    2121
    2222using System;
     23using System.Collections.Generic;
     24using System.Linq;
    2325using System.Runtime.Serialization;
    2426using HeuristicLab.Common;
     
    2931  public class LightweightJob : HiveItem {
    3032    [DataMember]
    31     public Guid? SlaveId { get; set; }
    32     [DataMember]
    33     public JobState JobState { get; set; }
    34     [DataMember]
    3533    public TimeSpan? ExecutionTime { get; set; }
    3634    [DataMember]
    37     public String Exception { get; set; }
     35    public Guid? ParentJobId { get; set; }
    3836    [DataMember]
    39     public DateTime DateCreated { get; set; }
     37    public List<StateLog> StateLog { get; set; }
    4038    [DataMember]
    41     public DateTime? DateCalculated { get; set; }
    42     [DataMember]
    43     public DateTime? DateFinished { get; set; }
    44     [DataMember]
    45     public Guid? ParentJobId { get; set; }
     39    public JobState State { get; set; }
     40
     41    public StateLog CurrentStateLog { get { return StateLog.Last(); } }
     42    public DateTime DateCreated { get { return StateLog.First().DateTime; } }
     43    public DateTime? DateFinished { get { return CurrentStateLog.State == JobState.Finished ? new DateTime?(CurrentStateLog.DateTime) : null; } }
    4644
    4745    public LightweightJob() {
    48       JobState = DataTransfer.JobState.Offline;
     46      StateLog = new List<DataTransfer.StateLog>();
    4947    }
     48
    5049    public LightweightJob(Job job) {
    51       this.SlaveId = job.SlaveId;
    52       this.JobState = job.JobState;
    5350      this.ExecutionTime = job.ExecutionTime;
    54       this.Exception = job.Exception;
    55       this.DateCreated = job.DateCreated;
    56       this.DateCalculated = job.DateCalculated;
    57       this.DateFinished = job.DateFinished;
    5851      this.ParentJobId = job.ParentJobId;
     52      this.StateLog = new List<StateLog>();
    5953    }
    60     protected LightweightJob(LightweightJob original, Cloner cloner) : base(original, cloner) {
    61       this.SlaveId = original.SlaveId;
    62       this.JobState = original.JobState;
     54    protected LightweightJob(LightweightJob original, Cloner cloner)
     55      : base(original, cloner) {
    6356      this.ExecutionTime = original.ExecutionTime;
    64       this.Exception = original.Exception;
    65       this.DateCreated = original.DateCreated;
    66       this.DateCalculated = original.DateCalculated;
    67       this.DateFinished = original.DateFinished;
    6857      this.ParentJobId = original.ParentJobId;
     58      this.StateLog = new List<StateLog>(original.StateLog);
    6959    }
    7060    public override IDeepCloneable Clone(Cloner cloner) {
    7161      return new LightweightJob(this, cloner);
    7262    }
     63
     64    public void SetState(JobState state) {
     65      this.State = state;
     66      this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now });
     67    }
     68
     69    public void SetState(JobState state, Guid userId) {
     70      this.State = state;
     71      this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, UserId = userId });
     72    }
     73
     74    public void SetState(JobState state, Guid slaveId, string exception) {
     75      this.State = state;
     76      this.StateLog.Add(new StateLog() { State = state, DateTime = DateTime.Now, SlaveId = slaveId, Exception = exception });
     77    }
    7378  }
    7479}
Note: See TracChangeset for help on using the changeset viewer.