Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 6595634f0eb8979b0bd28de7699fde0cd2e63ee9
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Mon Jul 28 16:20:04 2014 +0200
new queue for backend
---------------------------------------------------------------
.../coprs/views/backend_ns/backend_general.py | 36 +++++++++----------
.../test_backend_ns/test_backend_general.py | 2 +-
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
index 3c1b723..ba5ed04 100644
--- a/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
+++ b/frontend/coprs_frontend/coprs/views/backend_ns/backend_general.py
@@ -24,25 +24,23 @@ def waiting():
for action in actions_logic.ActionsLogic.get_waiting()
]
- # models.Builds
- builds_list = []
-
- for build in builds_logic.BuildsLogic.get_waiting():
- build_dict = build.to_dict(
- options={"copr": {"owner": {},
- "__columns_only__": ["id",
"name"],
- "__included_ids__": False
- },
- "__included_ids__": False})
-
- # return separate build for each chroot this build
- # is assigned with
- for chroot in build.chroots:
- build_dict_copy = build_dict.copy()
- build_dict_copy["chroot"] = chroot.name
- build_dict_copy[
- "buildroot_pkgs"] = build.copr.buildroot_pkgs(chroot)
- builds_list.append(build_dict_copy)
+ # tasks represented by models.BuildChroot with some other stuff
+ builds_list = [
+ {
+ "task_id": str(task.build.id)+"-"+task.mock_chroot.name,
+ "build_id": task.build.id,
+ "project_owner": task.build.copr.owner.name,
+ "project_name": task.build.copr.name,
+ "submitter": task.build.user.name,
+ "pkgs": task.build.pkgs,
+ "chroot": task.mock_chroot.name,
+ "buildroot_pkgs":
task.build.copr.buildroot_pkgs(task.mock_chroot),
+ "repos": task.build.repos,
+ "memory_reqs": task.build.memory_reqs,
+ "timeout": task.build.timeout
+ }
+ for task in builds_logic.BuildsLogic.get_build_task_queue()
+ ]
return flask.jsonify({"actions": actions_list, "builds":
builds_list})
diff --git
a/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
b/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
index c46d5b3..ec15ddb 100644
--- a/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
+++ b/frontend/coprs_frontend/tests/test_views/test_backend_ns/test_backend_general.py
@@ -14,7 +14,7 @@ class TestWaitingBuilds(CoprsTestCase):
self, f_users, f_coprs, f_mock_chroots, f_builds, f_db):
r = self.tc.get("/backend/waiting/", headers=self.auth_header)
- assert len(json.loads(r.data)["builds"]) == 4
+ assert len(json.loads(r.data)["builds"]) == 5
# status = 0 # failure