def update(self, values): """ :param values: a dict. """ self._check_for_update(values) was_locked = self.locked for k, v in values.items(): if k in self.allowed_update_keys: if k == 'vm_host': vm_host_name = v query = self.query.filter(Node.name == vm_host_name) v = query.one() setattr(self, k, v) if 'locked' in values: if self.locked != was_locked: self.locked_since = datetime.utcnow() if self.locked else None if not self.locked: self.locked_by = None Session.flush()
def _create_run(cls, name): log.info("Creating run: %s", name) Session.flush() return Run(name)
def update(self, json_data): self.set_or_update(json_data) Session.flush()