| |
@@ -22,7 +22,7 @@
|
| |
|
| |
from werkzeug.urls import url_encode
|
| |
|
| |
- from copr_common.enums import EnumType
|
| |
+ from copr_common.enums import EnumType, StatusEnum
|
| |
# TODO: don't import BuildSourceEnum from helpers, use copr_common.enum instead
|
| |
from copr_common.enums import BuildSourceEnum # pylint: disable=unused-import
|
| |
from copr_common.rpm import splitFilename
|
| |
@@ -46,7 +46,8 @@
|
| |
PROJECT_RPMS_DL_STAT_FMT = "project_rpms_dl_stat:hset::{copr_user}@{copr_project_name}"
|
| |
|
| |
|
| |
- FINISHED_STATUSES = ["succeeded", "forked", "canceled", "skipped", "failed"]
|
| |
+ FINISHED_STATES = ["succeeded", "forked", "canceled", "skipped", "failed"]
|
| |
+ FINISHED_STATUSES = [StatusEnum(s) for s in FINISHED_STATES]
|
| |
|
| |
|
| |
class WorkList:
|
| |
@@ -646,16 +647,18 @@
|
| |
"""
|
| |
By giving ``what`` string (e.g. "build") and ``items`` array, return string
|
| |
in either of those formats:
|
| |
- - "builds 1, 2, 3 and 4[ are]"
|
| |
+ - "builds 1, 2, 3, and 4[ are]"
|
| |
+ - "builds 1, 2, and others[ are]"
|
| |
- "builds 1 and 2[ are]"
|
| |
- "build 31[ is]"
|
| |
"""
|
| |
if len(items) > 1:
|
| |
- return "{}s {} and {}{}".format(
|
| |
- what,
|
| |
- ', '.join(str(item) for item in items[:-1]),
|
| |
- str(items[-1]),
|
| |
- " are" if be_suffix else ""
|
| |
+ return "{what}s {list}{comma} and {last}{be_suffix}".format(
|
| |
+ what=what,
|
| |
+ list=', '.join(str(item) for item in items[:-1]),
|
| |
+ comma=',' if len(items) > 2 else "",
|
| |
+ last=str(items[-1]),
|
| |
+ be_suffix=" are" if be_suffix else "",
|
| |
)
|
| |
return "{} {}{}".format(
|
| |
what,
|
| |
On @rubygems/rubygems in Fedora Copr, we faced timeouts when we tried to
disable mock chroots with too many BuildChroots. Turns out ORM lazy
loaded all the BuildChroot instances for disabled CoprChroot (which in
our case was more than 100k items).
Instead of this, prepare a custom query for related BuildChroots that
can be used with limit() safely.
For the purpose of the query, we need to use FINISHED_STATUSES variable
which was improperly using states, not statuses. So I'm fixing this
(status is the number, state is the string human-readable alternative).
Fixes: #1925