Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/02/11 15:23:59 (13 years ago)
Author:
cneumuel
Message:

#1233

  • changed the way lifecycle methods are called. The new service method TriggerLifecycle checks when the latest cleanup was made and performs one (if necessary). This can also be called by an external program (like a windows task)
  • robustified logging
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r5526 r5593  
    558558    #endregion
    559559
     560    #region Lifecycle Methods
     561    public DateTime GetLastCleanup() {
     562      using (var db = CreateContext()) {
     563        var entity = db.Lifecycles.SingleOrDefault();
     564        return entity != null ? entity.LastCleanup : DateTime.MinValue;
     565      }
     566    }
     567
     568    public void SetLastCleanup(DateTime datetime) {
     569      using (var db = CreateContext()) {
     570        var entity = db.Lifecycles.SingleOrDefault();
     571        if (entity != null) {
     572          entity.LastCleanup = datetime;
     573        } else {
     574          entity = new Lifecycle();
     575          entity.LifecycleId = 0; // always only one entry with ID:0
     576          entity.LastCleanup = datetime;
     577          db.Lifecycles.InsertOnSubmit(entity);
     578        }
     579        db.SubmitChanges();
     580      }
     581    }
     582    #endregion
    560583  }
    561584}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r5526 r5593  
    143143    </Type>
    144144  </Table>
     145  <Table Name="" Member="Lifecycles">
     146    <Type Name="Lifecycle">
     147      <Column Name="LifecycleId" Type="System.Int32" DbType="Int" IsPrimaryKey="true" CanBeNull="false" />
     148      <Column Name="LastCleanup" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
     149    </Type>
     150  </Table>
    145151</Database>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r5526 r5593  
    8383      </nodes>
    8484    </associationConnector>
    85     <associationConnector edgePoints="[(7.4687475 : 3.73240397135417); (7.4687475 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     85    <associationConnector edgePoints="[(7.4687475 : 3.73240397135417); (7.4687475 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    8686      <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
    8787      <nodes>
     
    104104      </nodes>
    105105    </associationConnector>
    106     <associationConnector edgePoints="[(6.5 : 3.17870198567708); (6.125 : 3.17870198567708)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     106    <associationConnector edgePoints="[(6.5 : 3.17870198567708); (6.125 : 3.17870198567708)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    107107      <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" />
    108108      <nodes>
     
    130130      </nodes>
    131131    </associationConnector>
    132     <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     132    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    133133      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
    134134      <nodes>
     
    163163      </nestedChildShapes>
    164164    </classShape>
    165     <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     165    <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    166166      <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" />
    167167      <nodes>
     
    170170      </nodes>
    171171    </associationConnector>
    172     <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     172    <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    173173      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" />
    174174      <nodes>
     
    184184      </nodes>
    185185    </associationConnector>
     186    <classShape Id="b4e7aaa8-a382-4560-a1fd-498de77e9340" absoluteBounds="1.75, 5.5, 2, 1.1939925130208327">
     187      <DataClassMoniker Name="/HiveDataContext/Lifecycle" />
     188      <nestedChildShapes>
     189        <elementListCompartment Id="03597a2c-5c5d-4c2c-b741-c49ab5aa34d5" absoluteBounds="1.7650000000000001, 5.96, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     190      </nestedChildShapes>
     191    </classShape>
    186192  </nestedChildShapes>
    187193</ordesignerObjectsDiagram>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r5526 r5593  
    6464    partial void UpdateHiveExperimentPermission(HiveExperimentPermission instance);
    6565    partial void DeleteHiveExperimentPermission(HiveExperimentPermission instance);
     66    partial void InsertLifecycle(Lifecycle instance);
     67    partial void UpdateLifecycle(Lifecycle instance);
     68    partial void DeleteLifecycle(Lifecycle instance);
    6669    #endregion
    6770   
     
    175178      {
    176179        return this.GetTable<HiveExperimentPermission>();
     180      }
     181    }
     182   
     183    public System.Data.Linq.Table<Lifecycle> Lifecycles
     184    {
     185      get
     186      {
     187        return this.GetTable<Lifecycle>();
    177188      }
    178189    }
     
    31903201    }
    31913202  }
     3203 
     3204  [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
     3205  public partial class Lifecycle : INotifyPropertyChanging, INotifyPropertyChanged
     3206  {
     3207   
     3208    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     3209   
     3210    private int _LifecycleId;
     3211   
     3212    private System.DateTime _LastCleanup;
     3213   
     3214    #region Extensibility Method Definitions
     3215    partial void OnLoaded();
     3216    partial void OnValidate(System.Data.Linq.ChangeAction action);
     3217    partial void OnCreated();
     3218    partial void OnLifecycleIdChanging(int value);
     3219    partial void OnLifecycleIdChanged();
     3220    partial void OnLastCleanupChanging(System.DateTime value);
     3221    partial void OnLastCleanupChanged();
     3222    #endregion
     3223   
     3224    public Lifecycle()
     3225    {
     3226      OnCreated();
     3227    }
     3228   
     3229    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LifecycleId", DbType="Int", IsPrimaryKey=true)]
     3230    public int LifecycleId
     3231    {
     3232      get
     3233      {
     3234        return this._LifecycleId;
     3235      }
     3236      set
     3237      {
     3238        if ((this._LifecycleId != value))
     3239        {
     3240          this.OnLifecycleIdChanging(value);
     3241          this.SendPropertyChanging();
     3242          this._LifecycleId = value;
     3243          this.SendPropertyChanged("LifecycleId");
     3244          this.OnLifecycleIdChanged();
     3245        }
     3246      }
     3247    }
     3248   
     3249    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LastCleanup", DbType="DateTime")]
     3250    public System.DateTime LastCleanup
     3251    {
     3252      get
     3253      {
     3254        return this._LastCleanup;
     3255      }
     3256      set
     3257      {
     3258        if ((this._LastCleanup != value))
     3259        {
     3260          this.OnLastCleanupChanging(value);
     3261          this.SendPropertyChanging();
     3262          this._LastCleanup = value;
     3263          this.SendPropertyChanged("LastCleanup");
     3264          this.OnLastCleanupChanged();
     3265        }
     3266      }
     3267    }
     3268   
     3269    public event PropertyChangingEventHandler PropertyChanging;
     3270   
     3271    public event PropertyChangedEventHandler PropertyChanged;
     3272   
     3273    protected virtual void SendPropertyChanging()
     3274    {
     3275      if ((this.PropertyChanging != null))
     3276      {
     3277        this.PropertyChanging(this, emptyChangingEventArgs);
     3278      }
     3279    }
     3280   
     3281    protected virtual void SendPropertyChanged(String propertyName)
     3282    {
     3283      if ((this.PropertyChanged != null))
     3284      {
     3285        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     3286      }
     3287    }
     3288  }
    31923289}
    31933290#pragma warning restore 1591
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs

    r5526 r5593  
    100100    Guid GetExperimentForJob(Guid jobId);
    101101    #endregion
     102
     103    #region Lifecycle Methods
     104    DateTime GetLastCleanup();
     105    void SetLastCleanup(DateTime datetime);
     106    #endregion
    102107  }
    103108}
Note: See TracChangeset for help on using the changeset viewer.