for row in res:
yield Job(self.backend, row.id, data=row)
- def create(self, build, arch, test=False, superseeds=None):
+ def create(self, build, arch, superseeds=None):
job = self._get_job("""
INSERT INTO
jobs
(
build_id,
- arch,
- test
+ arch
)
VALUES
(
- %s,
%s,
%s
)
RETURNING *""",
build,
arch,
- test,
)
# Set cache for Build object
def build(self):
return self.backend.builds.get_by_id(self.data.build_id)
- @property
- def test(self):
- return self.data.test
+ def is_test(self):
+ """
+ Returns True if this job belongs to a test build
+ """
+ return self.build.is_test()
@property
def related_jobs(self):
job = self.backend.jobs.create(
build=self.build,
arch=self.arch,
- test=self.test,
superseeds=self,
)
return True
# Enable the cache for test builds
- if self.test:
+ if self.is_test():
return True
# Otherwise disable the ccache
finished_at timestamp without time zone,
builder_id integer,
message text,
- test boolean DEFAULT true NOT NULL,
superseeded_by integer,
depcheck_succeeded boolean,
depcheck_performed_at timestamp without time zone,
CREATE VIEW public.job_queue AS
SELECT jobs.id AS job_id,
- rank() OVER (ORDER BY (NOT jobs.test), builds.priority DESC, jobs.created_at) AS rank,
+ rank() OVER (ORDER BY (NOT (builds.test_for_build_id IS NULL)), builds.priority DESC, jobs.created_at) AS rank,
jobs.arch
FROM (public.jobs
LEFT JOIN public.builds ON ((jobs.build_id = builds.id)))
FROM ((public.jobs
LEFT JOIN public.builds ON ((jobs.build_id = builds.id)))
LEFT JOIN public.packages ON ((builds.pkg_id = packages.id)))
- WHERE ((jobs.deleted_at IS NULL) AND (jobs.started_at IS NOT NULL) AND (jobs.finished_at IS NOT NULL) AND (jobs.failed IS FALSE) AND (jobs.test IS FALSE))
+ WHERE ((jobs.deleted_at IS NULL) AND (jobs.started_at IS NOT NULL) AND (jobs.finished_at IS NOT NULL) AND (jobs.failed IS FALSE) AND (builds.test_for_build_id IS NULL))
GROUP BY packages.name, jobs.arch;