X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=monitor%2Fdatabase%2Finfo%2Faction.py;h=6554de83a23faa08b795bda48be523aef147e980;hb=45fea95bb898f254ea7e987d7417e9091885fbee;hp=0cdad0a850e24f236c6f17fe3a5d52b913554358;hpb=9a1832f6a427951ce3607640893f0b2c9400a6ad;p=monitor.git diff --git a/monitor/database/info/action.py b/monitor/database/info/action.py index 0cdad0a..6554de8 100644 --- a/monitor/database/info/action.py +++ b/monitor/database/info/action.py @@ -83,6 +83,11 @@ class ActionRecord(Entity): # TODO: need to sort on 'round' since actions will not be globally sync'd. return cls.query.filter_by(**kwargs).order_by(ActionRecord.id.desc()).first() + @classmethod + def delete_recent_by(cls, since, **kwargs): + acts = cls.query.filter_by(**kwargs).filter(cls.date_created >= datetime.now() - timedelta(since)).order_by(cls.date_created.desc()) + for i in acts: i.delete() + # ACCOUNTING date_created = Field(DateTime,default=datetime.now) loginbase = Field(String,default=None) @@ -107,6 +112,8 @@ class ActionRecord(Entity): # NOTE: in case an exception is thrown while trying to perform an action. error_string = Field(String, default=None) + log_path = Field(String, default=None) + #issue = ManyToOne('IssueRecord') # NOTE: this is the parent relation to fb records. first create the # action record, then append to this value all of the findbad records we