Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
"""
Aborts the job
"""
- pass # XXX TODO
+ # Mark as aborted
+ self._set_attribute_now("aborted_at")
+ if user:
+ self._set_attribute("aborted_by", user)
+
+ def is_aborted(self):
+ """
+ Returns True if this job has been aborted
+ """
+ if self.aborted_at:
+ return True
+
+ return False
+
+ @property
+ def aborted_at(self):
+ return self.data.aborted_at
+
+ @lazy_property
+ def aborted_by(self):
+ if self.data.aborted_by:
+ return self.backend.users.get_by_id(self.data.aborted_by)
@property
def message(self):
log_size bigint,
log_digest_blake2s bytea,
deleted_at timestamp without time zone,
- deleted_by integer
+ deleted_by integer,
+ aborted_at timestamp without time zone,
+ aborted_by integer
);
ADD CONSTRAINT builds_pkg_id FOREIGN KEY (pkg_id) REFERENCES public.packages(id);
+--
+-- Name: jobs jobs_aborted_by; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.jobs
+ ADD CONSTRAINT jobs_aborted_by FOREIGN KEY (aborted_by) REFERENCES public.users(id);
+
+
--
-- Name: jobs jobs_build_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--