return (
sqlalchemy
.select(
- jobs.Job,
- )
- .select_from(
self.backend.jobs.running_jobs,
)
.where(
stmt = (
sqlalchemy
.select(
- jobs.Job,
- )
- .select_from(
self.running_jobs,
)
)
stmt = (
sqlalchemy
.select(
- sqlalchemy.func.count().label("running_jobs"),
- )
- .select_from(
- self.running_jobs,
+ sqlalchemy.func.count(
+ self.running_jobs,
+ ).label("running_jobs"),
)
)
stmt = (
sqlalchemy
.select(
- Job,
- )
- .select_from(
self.running_jobs,
)
)
)
.select_from(Job)
+ # Join builds
+ .join(
+ builds.Build,
+ builds.Build.id == Job.build_id,
+ )
+
# Filter out any deleted objects
.where(
builds.Build.deleted_at == None,
"""
stmt = (
sqlalchemy
-
- # Select jobs
.select(
Job,
)
- .select_from(Job)
- .join(
+ .select_from(
self.queue,
- self.queue.c.job_id == Job.id,
)
-
- # Order them by their rank
- .order_by(self.queue.c.rank)
-
- # Optionally limit
+ .join(
+ Job,
+ Job.id == self.queue.c.job_id,
+ )
.limit(limit)
)
"""
stmt = (
sqlalchemy
-
- # Select jobs
- .select(Job)
-
- # Filter by matching architectures
+ .select(
+ Job,
+ )
+ .select_from(
+ self.queue,
+ )
+ .join(
+ Job,
+ Job.id == self.queue.c.job_id,
+ )
.where(
- Job.arch in builder.supported_atches,
+ Job.arch.in_(builder.supported_arches),
)
-
- # Order them by their rank
- .order_by(self.queue.c.rank)
)
return self.db.fetch(stmt)
).label("used_build_time"),
)
+ # Join builds & jobs
+ .join(
+ builds.Build,
+ builds.Build.owner_id == User.id,
+ )
+ .join(
+ jobs.Job,
+ jobs.Job.build_id == builds.Build.id,
+ )
+
# Filter out some things
.where(
User.deleted_at == None,